Hi, Excuse me for asking this silly question. But I really couldn't understand why cov() and ccov() don't work for my calculation of covariance matrix.
a <- matrix(1:8, 2, 4) a [,1] [,2] [,3] [,4] [1,] 1 3 5 7 [2,] 2 4 6 8 > ccov(a) Error in solve.default(cov, ...) : Lapack routine dgesv: system is exactly singular I also tried colume bind, but it still doesn't work. > a1<- a[,1] > a2 <- a[,2] > a3<- a[,3] > a4 <- a[,4] > acomb <- cbind(a1,a2,a3,a4) > acomb a1 a2 a3 a4 [1,] 1 3 5 7 [2,] 2 4 6 8 > ccov(acomb) Error in solve.default(cov, ...) : Lapack routine dgesv: system is exactly singular Yesterday, I used cov(), my function worked well. But today I ran the same code, it returned an error like: cov(td12) Error in solve.default(cov, ...) : system is computationally singular: reciprocal condition number = 1.97276e-24 In addition: Warning message: 'cov' is deprecated. Use 'ccov' instead. See help("Deprecated") I don't know what is wrong, and I appreciate you kind help! Thank you! Wendy [[alternative HTML version deleted]] ______________________________________________ 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.