Dear Michael, The SLLN hasn't failed. :-) In this particular example, it looks like the sample means are simply converging at a rate which is slower than desired.
Unfortunately, your particular loggamma doesn't have a finite fourth moment; so you don't have the usual (worst case) convergence rate proportional to sqrt(log (log(n)) / n) by the law of the iterated logarithm. In fact, your loggamma has only finite moments less than 2.6... see below. Again, the SLLN still holds. But convergence is slow. I have double-checked and the source code for both mlgamma AND rlgamma in the actuar package are correct. There may be other people who can identify numerical issues that slow down the convergence rate even more. Best, Jay P.S. the MGF of gamma is all you need for the moments of loggamma... E(X^k) = (1 - k / 2.6)^(-25) On Sat, Jun 14, 2008 at 4:54 AM, michaelhk82 <[EMAIL PROTECTED]> wrote: > > Hi. > 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? > > Code: > > 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 > moment. > (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? > > Michael > -- > 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. > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- *************************************************** G. Jay Kerns, Ph.D. Assistant Professor / Statistics Coordinator Department of Mathematics & Statistics Youngstown State University Youngstown, OH 44555-0002 USA Office: 1035 Cushwa Hall Phone: (330) 941-3310 Office (voice mail) -3302 Department -3170 FAX E-mail: [EMAIL PROTECTED] http://www.cc.ysu.edu/~gjkerns/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.