运行mahalanobis
距离
Error in solve.default(cov, ...) :
Lapack routine dgesv: system is exactly singular: U[2,2] = 0
这是我的代码。
calibration <- 10
mean <- colMeans(x[1:calibration,])
sx <- cov(x[1:calibration,])
d <- mahalanobis(x[1:calibration,], mean, sx)
这是数据
1 0.7071068
0 0.0000000
2 1.4142136
2 1.4142136
0 0.0000000
0 0.0000000
2 1.4142136
1 0.7071068
1 0.7071068
0 0.0000000
如何避免此错误?