|
Re: Weighted standard deviation in IDL [message #93436 is a reply to message #93435] |
Thu, 14 July 2016 13:03  |
Heinz Stege
Messages: 189 Registered: January 2003
|
Senior Member |
|
|
On Thu, 14 Jul 2016 09:06:42 -0700 (PDT), cb16 wrote:
> Hi!
>
> What is the best way to calculate a weighted standard deviation in IDL? Is there some function that does this?
Here is an excerpt from a function of mine:
wsum=total(weight,double=double)
xmean=total(xvals*weight,double=double)/wsum
xvar=total((xvals-xmean)^2*weight,double=double)/wsum
xmean_error=(xvar/(count-1))^.5
xstdev=xmean_error*count^.5
xmin=min(xvals,max=xmax)
xrms=(xvar+xmean^2)^.5
Cheers, Heinz
|
|
|