避免在Mahalanobis距离内的Lapack常规dges

时间:2015-10-08 09:15:15

标签: r lapack mahalanobis

运行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

如何避免此错误?

0 个答案:

没有答案