.Purpose To look at convergence concepts package and see where it leads to .

> library(ConvergenceConcepts)

Explore the modes of convergence

Here is an example which can be used to understand modes of convergence Let X1,X2, . . . be independent, identically distributed, continuous random variables with a N(2,9) distribution. Define Yi = (0.5)^i Xi, i = 1, 2, . . .. Also define Tn and An to be the sum and the average, respectively, of the terms Y1,Y2, . . . ,Yn.


I will try to solve using the ways I know, which is by simulation. .Data Preparation

> M <- 1000
> N <- 1000
> mu <- 2
> sigma <- 9
> x <- matrix(rnorm(M * N, mu, sigma), nrow = M, ncol = N)
> y <- x
> for (i in seq_along(x[1, ])) {
+     y[, i] <- (0.5)^(1:M) * x[, i]
+ }
> Tn <- x[M, ]
> An <- x[M, ]
> for (i in seq_along(y[1, ])) {
+     Tn[i] <- sum(y[, i])
+     An[i] <- mean(y[, i])
+ }

(a) Is Yn convergent in probability to 0?

> hist(y[M, ])
> summary(y[M, ])
       Min.     1st Qu.      Median        Mean     3rd Qu.        Max.
-2.971e-300 -4.135e-301  1.855e-301  1.695e-301  7.390e-301  2.887e-300

Play101-003.jpg

Yes '' (b) Is Tn convergent in probability to 2?

> hist(Tn)
> summary(Tn)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
-15.030  -1.152   1.892   2.106   5.391  20.010

Play101-004.jpg

Yes '' (c) Is An convergent in probability to 0?

> hist(An)
> summary(An)
     Min.   1st Qu.    Median      Mean   3rd Qu.      Max.
-0.015030 -0.001152  0.001892  0.002106  0.005391  0.020010

Play101-005.jpg

Yes '' (d) Is Tn convergent in law to a N(2,3) ?

> qqnorm((Tn - 2)/3)
> qqline((Tn - 2)/3)

Play101-006.jpg

Yes '' Now using the package (a) Is Yn convergent in probability to 0?

> genYn <- function(n) {
+     res <- (0.5)^(1:n) * rnorm(n, 2, 3)
+     return(res)
+ }

Yes We can zoom in the left panel (from n1 = 1 to n2 = 10) and see the 10 sample paths going rapidly inside the horizontal band . Looking at the evolution of pn towards 0 in the right panel, we can assume that Yn converges in probability towards 0. '' (b) Is Tn convergent in probability to 2?

> genTn <- function(n) {
+     res <- cumsum((0.5)^(1:n) * rnorm(n, 2, 3)) - 2
+     return(res)
+ }

No My intuition went for a complete toss as the tool showed that each of the sample path quickly converged to a number and they were different numbers for different samples! Each one of the sample paths rapidly evolve towards an horizontal asymptote, not the same for each sample path, and not contained inside the horizontal band. Looking at the evolution of pn in the right panel of Figure 6, we can assume that Tn does not converge in probability towards 2. '' (c) Is An convergent in probability to 0?

> genAn <- function(n) {
+     x <- 1:n
+     res <- (cumsum((0.5)^(1:n) * rnorm(n, 2, 3)))/cumsum(x)
+     return(res)
+ }

Yes In this case, we can zoom in (from n1 = 1 to n2 = 50) to better see the sample paths which all end up inside the horizontal band. Looking at the evolution of pn towards 0 in the right panel of Figure 7, we can assume that An converges in probability towards 0. '' (d) Is Tn convergent in law to a N(2,3) ?

> genTnL <- function(n) {
+     res <- cumsum((0.5)^(1:n) * rnorm(n, 2, 3))
+     return(res)
+ }

Yes I had no tools at my disposal to check the convergence in law and thanks to this wonderful package, I can visually see the convergence in front of my eyes. '' Here is another problem Problem 2: Let X1,X2, . . . be i.i.d. random variables with a uniform distribution on [0,1]. We define Mn = max{X1, . . . ,Xn}. (a) Show that Mn converges in probability and almost surely to 1.

> genMn <- function(x) {
+     res <- cummax(runif(n)) - 1
+     return(res)
+ }

(b) Show that Mn converges in quadratic mean to 1

Today I understood modes of convergence in a clear way, thanks to this wonderful package called ConvergenceConcepts.