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

Home » Public Forums » archive » Re: mean and stdev w/ errors
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: mean and stdev w/ errors [message #71033] Tue, 25 May 2010 13:00
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On May 25, 1:07 pm, Gray <grayliketheco...@gmail.com> wrote:
> Hi all,
>
> I have a set of observations and errors associated with them.  I'd
> like to calculate the mean and standard deviation of this sample,
> taking the errors into account.  Does anyone have a routine that does
> this?  Thanks!

I don't have a routine to do this. But for Gaussian statistics, it's
pretty simple.

; VALUE - sample values
; SIGMA - sample uncertainties (gaussian statistics)
; AVG_VALUE - output weighted mean value
; AVG_SIGMA - output standard error of weighted mean
pro weighted_mean, value, sigma, avg_value, avg_sigma
wts = 1/sigma^2
totwts = total(wts)

avg_value = total(wts*value) / totwts
avg_sigma = 1/sqrt(totwts)
end
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: regress
Next Topic: Matching data in different time resolution

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

Current Time: Wed Oct 08 18:36:12 PDT 2025

Total time taken to generate the page: 0.00525 seconds