**Freakonometrics - Tag - R-english**, and kindly contributed to R-bloggers)

Yesterday, we have discussed briefly sums and maximas of i.i.d. random variables using the concept of *subexponential* distributions. Today, we will introduce the concept of regular variation: a positive function is said to be regularly varying (at infinity), denoted , for some , if

for all . An this concept can be related to sums and maxima (see section 6.2.6 in Embrechts *et al*. (1997)). Consider i.i.d. positive random variables : let and . Then it can be shown easily that

- if and only if

- for some if and only if the exists a non-degenerate variable such that

- with if and only if

If is not that simple to check for such convergences, it is still possible to use graphs to study the behavior of the empirical version of those quantities. Consider the following function to visualize convergence of empirical ratios,

CONVERGENCE=function(g,p=1,n=500000){ set.seed(1) X=g(n);X1=g(n);X2=g(n);X3= g(n);X4=g(n) Tp =cummax(X^p)/cumsum(X^p) Tp1=cummax(X1^p)/cumsum(X1^p) Tp2=cummax(X2^p)/cumsum(X2^p) Tp3=cummax(X3^p)/cumsum(X3^p) Tp4=cummax(X4^p)/cumsum(X4^p) plot(Tp4,type="l",ylim=c(0,1),log="x", xlim=c(100,n),ylab="",col="light blue",xlab="") lines(Tp1,col="light green") lines(Tp2,col="yellow") lines(Tp3,col="pink") lines(Tp,lwd=2) abline(h=0:1,col="red",lty=2) }

or the following to study the “asymptotic” distribution of the ratio on simulated samples

LIMITDIST=function(g,p=1,n=500000,ns=1000){ set.seed(1) T=rep(NA,ns) for(i in 1:ns){ X=g(n) T[i]=max(X^p)/sum(X^p) } hist(T,breaks=seq(0,1,by=.05),probability=TRUE, col="light green",ylab="",xlab="",main="") }

In the case of exponentially distributed variables, we have

CONVERGENCE(rexp)

For variables with a lognormal distribution,

CONVERGENCE(rlnorm)

And finally, consider the case of a Pareto distribution

rpareto=function(n){runif(n)^(-1/1.5)-1} CONVERGENCE(rpareto)

Here, it looks like those three distributions have finite variance (and actually, they do). To go one step further, for , define and . Then analogous results can be derived,

- if and only if

- for some if and only if the exists a non-degenerate variable such that

- with if and only if

Again, it is possible to use the function defined above,

CONVERGENCE(rexp,p=2)

or

CONVERGENCE(rexp,p=3)

or even

CONVERGENCE(rexp,p=10)

If the power is not too high, it looks like the ratio goes to zero. But when it becomes larger, it looks like more simulations might be necessary to say something relevant.

CONVERGENCE(rlnorm,p=2)

or

CONVERGENCE(rlnorm,p=3)

Here also, it looks like we have a light tailed distribution (and actually, it is the case). And finally, if we consider the case of a Pareto distribution

CONVERGENCE(rpareto,p=2)

Then it looks like it is an heavy tailed distribution. In order to get a better understanding, plot the distribution of the ratio obtained from 1,000 simulated samples (of size 500,000),

LIMITDIST(rpareto,p=1)

versus

LIMITDIST(rpareto,p=2)

So obviously, something is going on between 1 and 2 (recall that the power parameter of the Pareto distribution is 1.5).

**leave a comment**for the author, please follow the link and comment on his blog:

**Freakonometrics - Tag - R-english**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...