Peter Dalgaard wrote:
> Arun Kumar Saha wrote:
>> Suppose I have a Variance-covariance matrix A. Is there any fast way to
>> calculate correlation matrix from 'A' and vice-versa without emplying
>> any
>> 'for' loop?
>>
> C <- cov2cor(A)
>
> The other way around is ill-defined, but if d is the v
check the following:
# covariance matrix
V <- var(matrix(rnorm(10*4), 10, 4))
cov2cor(V)
# correlation matrix
R <- cov2cor(V)
# vector of std. dev.
sds <- rnorm(4)^2
R * sds * rep(sds, each = nrow(R))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Biostatistical Centre
School of Pu
Arun Kumar Saha wrote:
Suppose I have a Variance-covariance matrix A. Is there any fast way to
calculate correlation matrix from 'A' and vice-versa without emplying any
'for' loop?
C <- cov2cor(A)
The other way around is ill-defined, but if d is the vector of variances,
d <- sqrt(diag(A))
A
3 matches
Mail list logo