Code covered by the BSD License

### Highlights from lmom.m

5.0
5.0 | 3 ratings Rate this file 8 Downloads (last 30 days) File Size: 809 Bytes File ID: #5874 Version: 1.0

# lmom.m

### Kobus Bekker (view profile)

14 Sep 2004 (Updated )

Calculates any number of l-moments.

File Information
Description

This m-file calculates any number of l-moments for given data vector X. It uses probability weighted moments (can actually edit the file to give any number of pwm's) and the coefficients of the shifted Legendre polynomial to calculate the l-moments.

MATLAB release MATLAB 6.5 (R13)
MATLAB Search Path
`/`
Other requirements FILE REQUIRED: % LegendreShiftPoly.m by Peter Roche, 12-08-2004. This file is available on the Matlab File Exchange. Thanks to Peter for his work.
07 Sep 2012 Kun

### Kun (view profile)

T4 calculation is correct. Actually the estimate of T4 is random variable by itself, which follows normal distribution asymptotically.

Following code illustrate the idea, and the sample mean T4 approach 0.1226 in the long run.

N = 10000;
ks = ones(N,1);
for i=1:N
x = randn(1000,1);
l = lmom(x,4);
ks(i) = l(4)/l(2);
end
hist(ks,100);
title(sprintf('Avg.T4=%.4f',mean(ks)));

26 Apr 2011 Luca

### Luca (view profile)

I tried this code:
x = randn(100000,1);
L = lmom(x,4)
L =
0.0038 0.5650 0.0005 0.0685

In fact L4 != 0.1226 !!!

but you can evaluate:
T4 = L4/L2 = 0.1213

Comment only
21 Apr 2011 Luca

21 Apr 2011 Luca

### Luca (view profile)

ok, I found it

Comment only
25 Nov 2010 Anand Anand

### Anand Anand (view profile)

I generated 1000 random nos from normal distribution(5,0.2)..i tried lmom(x)...the first three moments are right but the 4 moment kurtosis comes around 0.0137 while L4 for a normal dist is 0.1226...What is causing this discrepancy?

Comment only
12 Apr 2006 Steven Gray

Fast and very useful.