Re: [R] SLLN for loggamma fails for 2 order moments

From: G. Jay Kerns <>
Date: Sat, 14 Jun 2008 19:46:28 -0400

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.


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 <> 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:
> Sent from the R help mailing list archive at
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> 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

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sat 14 Jun 2008 - 23:54:16 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 15 Jun 2008 - 08:30:43 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive