All 'variance' functions compute the sample variance which is
an unbiased estimate.
f = (/ 7, 9, -2, -8, 2/)
favg = avg(f) ; average
fdev = f-favg ; deviations
fdev2 = fdev^2 ; deviations squared
nf = dimsizes(f) ; N
pvar = sum(fdev2)/nf ; population variance
svar = sum(fdev2)/(nf-1) ; sample variance
var1 = variance(f)
var2 = dim_variance(f)
var3 = dim_variance_n(f,0)
print("pvar="+pvar+" svar="+svar+" var1="+var1+" var2="+var2+"
var3="+var3)
===
output: pvar=37.84 svar=47.3 var1=47.3 var2=47.3 var3=47.3
The quote below "... population variance" is incorrect. It will
be changed to 'sample variance'. Thank you.
On 4/7/12 11:34 PM, heaven_bird334 wrote:
> Hi,
> Did anybody know the value calculated by the function "dim_variance"
> /"dim_variance_n" is "population variance" or "sample variance"?
>
> I am a little puzzle after I read the following sentence on
> http://www.ncl.ucar.edu/Document/Functions/Built-in/dim_variance.shtml:
> "Technically, this function calculates an estimate of the population
> variance. This means that it divides by [1/(N-1)] where N is the total
> number of non-missing values."
>
> As I know (please see
> http://en.wikipedia.org/wiki/Variance#Population_variance_and_sample_variance),
> the population mean o r population variance means it divides by [1/N],
> not by [1/(N-1)]. Does the NCL web documents get a written mistake there?
>
> Any suggestion or information is greatly appreciated.
>
>
> Best Regards,
> Li
>
>
>
>
>
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Apr 8 10:35:27 2012
This archive was generated by hypermail 2.1.8 : Mon Apr 09 2012 - 13:43:03 MDT