[Thread Prev][Thread Next][Index]

variance: @VAR and @MODVAR



Hi all,

There seems to be some inconsistency between the Ferret "variable
transform" @VAR and the "regridding transform" @MODVAR, both of which
purport to compute the sample variance.  Given N elements, @MODVAR
correctly divides the sum-of-squares by N-1, the number of degrees of
freedom.  But @VAR divides by N, giving an underestimate of the variance
for small N.

An example:

yes? def ax/x=1:1:1/modulo xax
yes? let a = {0,2}
yes? let a2 = (a-a[i=@ave])^2

! Here @MODVAR gives the right answer for the variance.
yes? list a[gx=xax@modvar], a2[i=@sum]/(a[i=@ngd]-1)
 Column  1: A[G=1 delta on X@MODVAR,X=1] is Variance of {0,2} (regrid: 1 delta on X@MODVAR)
 Column  2: EX#2 is A2[I=@SUM]/(A[I=@NGD]-1)
              A   EX#2 
I / *:     2.000  2.000

! But @VAR gives a low-biased estimate.
yes? list a[i=@var], a2[i=@sum]/a[i=@ngd]
             X: 0.5 to 2.5
 Column  1: A[X=@VAR] is Variance of {0,2}
 Column  2: EX#2 is A2[I=@SUM]/A[I=@NGD]
              A   EX#2 
I / *:     1.000  1.000


Are there any wishes/plans to make these consistent?  Preferably by making
@VAR divide by N-1 instead of N?

Andrew

+--------------------------------------------------------+
|   Dr. Andrew T. Wittenberg   |        GFDL/NOAA        |
|  Andrew.Wittenberg@noaa.gov  |      Princeton, NJ      |
+--------------------------------------------------------+




[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement