comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » L-moments
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: L-moments [message #75408 is a reply to message #75329] Mon, 28 February 2011 03:43 Go to previous message
rogass is currently offline  rogass
Messages: 200
Registered: April 2008
Senior Member
On 25 Feb., 16:25, Mark Shephard <mark.w.sheph...@gmail.com> wrote:
> Hi,
>
> I was wondering if anyone has anyone develope IDL routines for the
> method of L-moments?
>
> Thanks,
> Mark

Hi Mark,
something like this?

function cr_binomial,n,m
n1=1d & m1=1d & n1m1=1d
for i=1d,n do n1*=i
for i=1d,m do m1*=i
for i=1d,(n-m) do n1m1*=i
return,n1/(m1*n1m1)
end

function cr_l_moment,dat
n=n_elements(dat)
l1 = total(dat,/double)/cr_binomial(n,1)
l2=0d &l3=0d &l4=0d
for i=1d,n do begin
b1 = cr_binomial(i-1,1d)
b2 = cr_binomial(n-i,1d)
b3 = cr_binomial(i-1,2d)
b4 = cr_binomial(n-i,2d)
b5 = cr_binomial(i-1,3d)
b6 = cr_binomial(n-i,3d)
l2+=(b1-b2)*dat[i-1l]
l3+=(b3-2*b1*b2+b4)*dat[i-1l]
l4+=(b5-3*b3*b2+3*b1*b4+b6)*dat[i-1l]
endfor
l2*=0.5d /cr_binomial(n,2d )
l3*=(1d / 3d )/cr_binomial(n,3d )
l4*=(1d / 4d )/cr_binomial(n,4d )
return,{l1:l2,l2:l2,l3:l3,l4:l4}
end

IDL> r=randomu(seed,5,5)
IDL> inf=cr_l_moment(r)
IDL> print,float(inf)
{ -0.000558181 -0.000558181 -0.0111168 0.212071}

Cheers

CR
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: scripted object graphics question
Next Topic: Combination

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 23:56:57 PDT 2025

Total time taken to generate the page: 0.80222 seconds