# Re: Help: Does "dim_variance" compute "population variance" or "sample variance"?

From: heaven_bird334 <heaven_bird334_at_nyahnyahspammersnyahnyah>
Date: Mon Apr 09 2012 - 09:15:34 MDT

Dear Dennis,
Thank you very much for all your quickly efficient help. Please take a rest.
Happy Easter to you!

Best Regards,
Li

At 2012-04-09 21:27:38,"Dennis Shea" <shea@ucar.edu> wrote:
>Hi Li,
>
>(1) The population mean is the 'avg' , 'dim_avg', 'dim_avg_n'
>(2) Population variance can be readily calculated from the
> sample variance.
>
> N = num(.not.ismissing(f))
> var1 = variance(f)*(N-1)/N
>
>(3) There are no plans to create population versions of the
> assorted function you mention.
>
>(4) Could you please post to ncl-talk@ucar.edu ?
> I spent 6+ hours answering emails sent directly to me.
> I can not spend that much time any more.
>
>Cheers
>D
>
>
>On 4/8/12 8:47 PM, heaven_bird334 wrote:
>> Dear Dennis,
>>
>> Thank you very much for your quickly efficient response on Easter holidays.
>>
>> Now, I have some further questions, which are my real concerns:
>>
>> 1) Does NCL have the functions to calculate population variance or
>> population mean now? If not, will your team develop new ones or update
>> the old ones in the future?
>>
>> 2) Some times, an correlation or auto-correlation function will cause a
>> correlation coefficient bigger than 1. This kind of problem are usually
>> due to using sample mean/variance (divides by [1/(N-1)]) instead of
>> using population mea n/variance (divides by [1/N]) in calculation, or
>> say sample correlation/covariance functions. I notice that NCL's
>> correlation/covariance, auto-crrelation/auto-covariance functions, such
>> as "esacr", "esacv", "esccr", "esccv", "escorc", "escovc" et al., are
>> all sample ones. Does NCL have population correlation/covariance,
>> auto-crrelation/auto-covariance functions? If not, will your team
>> develop new ones or update the old ones in the future?
>>
>> Happy Easter to you!
>>
>> Beset Regards,
>> Li
>>
>>
>>
>> At 2012-04-09 00:35:16,"Dennis Shea" <shea@ucar.edu> wrote:
>>>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 Mon Apr 9 09:15:58 2012

This archive was generated by hypermail 2.1.8 : Mon Apr 09 2012 - 13:43:03 MDT