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 vector of variances, Doh. Edited code, but not text... Vector of standard deviations, of course. > > d <- sqrt(diag(A)) > A <- outer(d, d)*C. >
-- O__ ---- Peter Dalgaard Ă˜ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.