[R] A basic statistics question

Rolf Turner r.turner at auckland.ac.nz
Tue Aug 12 23:41:52 CEST 2014


On 13/08/14 07:57, Ron Michael wrote:
> Hi,
>
> I would need to get a clarification on a quite fundamental statistics property, hope expeRts here would not mind if I post that here.
>
> I leant that variance-covariance matrix of the standardized data is equal to the correlation matrix for the unstandardized data. So I used following data.

<SNIP>

> (t(Data_Normalized) %*% Data_Normalized)/dim(Data_Normalized)[1]
>
>
>
> Point is that I am not getting exact CORR matrix. Can somebody point me what I am missing here?

You are using a denominator of "n" in calculating your "covariance" 
matrix for your normalized data.  But these data were normalized using 
the sd() function which (correctly) uses a denominator of n-1 so as to 
obtain an unbiased estimator of the population standard deviation.

If you calculated

    (t(Data_Normalized) %*% Data_Normalized)/(dim(Data_Normalized)[1]-1)

then you would get the same result as you get from cor(Data) (to within 
about 1e-15).

cheers,

Rolf Turner

-- 
Rolf Turner
Technical Editor ANZJS



More information about the R-help mailing list