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 Thomas Jacobs To statalist@hsphsun2.harvard.edu Subject Re: st: Mata Variance Calculation Date Fri, 14 May 2010 17:03:34 -0500

```Tirthankar,

Thanks very much!

Tom

On Fri, May 14, 2010 at 4:39 PM, Tirthankar Chakravarty
<tirthankar.chakravarty@gmail.com> wrote:
> 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/
>

--
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/
```