Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: Mata Variance Calculation

 From Tirthankar Chakravarty To statalist@hsphsun2.harvard.edu Subject Re: st: Mata Variance Calculation Date Sat, 15 May 2010 03:09:13 +0530

```Yes. While the documentation does not tell you the exact formula, it
does tell you that the mean involved is calculated, which ends up
costing one degree of freedom in the variance calculation.
***************************
clear*
mata
mA = runiform(100, 1)
sum((mA :-mean(mA)):^2)/rows(mA)
sum((mA :-mean(mA)):^2)/(rows(mA)-1)
end
***************************

T

2010/5/15 Thomas Jacobs <thomasjacobs@gmail.com>:
> Hi,
>
> Can anyone confirm whether the variance function in mata is a sample
> value (with n-1 observations) as opposed to a population (with n
> observations) measure?
>
> IOTW, I have a column vector of 100 values and apply the variance
> function.  Is n=99?  From my own calculations it appears to be so but
> I wish to be sure and it is not stated in the documentation.  Thanks.
>
> Tom
>
> --
> Thomas Jacobs
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>

--
To every ω-consistent recursive class κ of formulae there correspond
recursive class signs r, such that neither v Gen r nor Neg(v Gen r)
belongs to Flg(κ) (where v is the free variable of r).

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```