```Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: L moments
Date: Wed, 27 Oct 2010 00:17:04 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 16
Message-ID: <ia7r20\$pvg\$1@fred.mathworks.com>
References: <ia4853\$ofq\$1@fred.mathworks.com>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1288138624 26608 172.30.248.37 (27 Oct 2010 00:17:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 27 Oct 2010 00:17:04 +0000 (UTC)
Xref: news.mathworks.com comp.soft-sys.matlab:681550

"Anand Anand" <tranand3@gmail.com> wrote in message <ia4853\$ofq\$1@fred.mathworks.com>...
> How do i calculate the L moments for a given set of data using MATLAB?
- - - - - - - - - - -
I see no matlab functions for directly computing L moments, not even in the Statistics Toolbox.  However there are formulas given in the two websites below for computing them for a given data sample using two differing forms.  The first site gives a direct formula whereas the second computes them by way of "probability weighted moments".

http://en.wikipedia.org/wiki/L-moment

http://www.itl.nist.gov/div898/software/dataplot/refman2/auxillar/lmoment.htm

You could check your work by comparing results from the two equivalent formulas.

In each case it is necessary to first sort your discrete data values in ascending sizes.  As long as the number of points in the data is not excessively large you could use the 'nchoosek' function with a scalar input number to directly compute the binomial coefficients used in the formulas.  If that gives you trouble, you may have to generate these using the matlab 'prod' function in such a way as not to produce intermediate overflows.

Do you plan to go much beyond the first four moments?  If not that will simplify matters for you.  The formulas become more awkward to realize for the later moments.

Roger Stafford
```