Dear R-devel,
Would R Core consider adding an optional argument to var() and sd() to allow 
calculation with denominator n?
My motivation comes from teaching statistics through empirical distributions. 
For the empirical distribution assigning probability 1/n to each observation, 
the variance is exactly

mean((x - mean(x))^2)

The current var() applies Bessel�s correction. That is useful for unbiased 
estimation under i.i.d. sampling, but the uncorrected empirical moment is also 
useful for descriptive statistics and for teaching estimation by substituting 
the empirical distribution for an unknown distribution. These uses arise even 
when the observations constitute a sample.
One possible argument would be correction = 1, retaining current behavior by 
default, with correction = 0 selecting denominator n. The same argument in sd() 
would preserve its relationship with var().
There is already a precedent in cov.wt(..., method = "ML"). Making the choice 
available directly in var() and sd() would improve discoverability and avoid 
requiring a separate function for this basic calculation. Consistent support in 
cov() would also be desirable.
I found a related R-devel discussion from February 2019: 
https://stat.ethz.ch/pipermail/r-devel/2019-February/077300.html
The argument name and scope could follow R Core�s preferences.
Thank you for considering this request,

Jordan Adamson
Assistant Professor, Economics Department
Thompson Rivers University


        [[alternative HTML version deleted]]

______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to