# check-convergence: Check convergence In ConvergenceConcepts: Seeing Convergence Concepts in Action

## Description

This function enables one to investigate the four classical modes of convergence on simulated data: in probability, almost surely, in r-th mean and in law.

## Usage

 1 2 check.convergence(nmax,M,genXn,argsXn=NULL,mode="p",epsilon=0.05,r=2,nb.sp=10, density=FALSE,densfunc=dnorm,probfunc=pnorm,tinf=-3,tsup=3,plotfunc=plot,...) 

## Arguments

 nmax number of points in each sample path. M number of sample paths to be generated. genXn a function that generates the Xn-X values, or only the Xn values in the law case. argsXn a list of arguments to genXn. mode a character string specifying the mode of convergence to be investigated, must be one of "p" (default), "as", "r" or "L". epsilon a numeric value giving the interval endpoint. r a numeric value (r>0) if convergence in r-th mean is to be studied. nb.sp number of sample paths to be drawn on the left plot. density if density=TRUE, then the plot of the density of X and the histogram of Xn is returned. If density=FALSE, then the plot of the distribution function F(t) of X and the empirical distribution Fn(t) of Xn is returned. densfunc function to compute the density of X. probfunc function to compute the distribution function of X. tinf lower limit for investigating convergence in law. tsup upper limit for investigating convergence in law. plotfunc R function used to draw the plot: for example plot or points. ... optional arguments to plotfunc.

## Details

The objective of this function is to investigate graphically the convergence of some random variable Xn to some random variable X. In order to use it, you should be able to provide generators of Xn and X (or of Xn-X). The four modes of convergence that you can try are: in probability, almost surely, in r-th mean and in law. For the convergence in law, we compute hat(l)_n(t)=|\hat{F}_n(t)-F(t)| for ten values equally distributed between tinf and tsup.

## Author(s)

P. Lafaye de Micheaux and B. Liquet

## References

Lafaye de Micheaux, P. (plafaye@club.fr), Liquet, B. "Understanding Convergence Concepts: a Visual-Minded and Graphical Simulation-Based Approach", The American Statistician, 63:2, 173–178, (2009).

criterion, generate, investigate, law.plot2d, law.plot3d, p.as.plot, visualize.crit, visualize.sp
  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ## Not run: ####################### Exercise 3 ############################## # Let X1, X2, ..., Xn be independent random variables such that # # P[Xn=sqrt(n)]=1/n and P[Xn=0]=1-1/n # # Does Xn converges to 0 in 2-th mean? in probability? # ################################################################# options(example.ask=FALSE) pnotrgen<-function(n){rbinom(n,1,1/(1:n))*sqrt(1:n)} check.convergence(nmax=1000,M=500,genXn=pnotrgen,mode="r",r=2) legend(100,6,legend=expression(hat(e)["n,2"]),lty=1) tt3.1 <<- check.convergence(nmax=1000,M=500,genXn=pnotrgen,mode="p") ## End(Not run)