[R] SLLN for loggamma fails for 2 order moments

michaelhk82 michaelhk82 at yahoo.dk
Sat Jun 14 10:54:09 CEST 2008

I was trying to calculate 2. order moment for a loggamma sample.
Also, I checked it with the function mlgamma from the package actuar, which
calculates moments based on loggamma parameters.
Se below - I get big deviations. Numerical integration suggests that mlgamma
gets it right. What fails 
in my attempt to use SLLN to estimate the 2. order moments?


sum(rlgamma(10^6,25,2.6)^2)/10^6 #Estimation by SLLN
[1] 1.964011e+13
> mlgamma(2,25,2.6)                      #2.order moment by mlgamma
[1] 8.328225e+15

The difference is more than a factor 100!
I have tried to run the code several times but I never manage to exceed the
value of mlgamma - that is, by SLLN I keep underestimating the 2. order
(and tried with larger samples as well, but my cpu wont accept sample larger
than 10^7).

Does anyone have an idea of what is happening?

View this message in context: http://www.nabble.com/SLLN-for-loggamma-fails-for-2-order-moments-tp17837233p17837233.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list