Warning message:
In paleomorph::covar(residual.lms) :
CVM has negative eigenvalue -4.72260357166595e-16
> cov.mat <- as.matrix(Matrix::nearPD(cov.mat)$mat)
> sum(diag(cov.mat))
[1] 58.56841
>
> Cov[1:4, 1:4]
[,1] [,2] [,3] [,4]
[1,] 0.839641260 -0.004745748 -0.06877096 0.02690825
[2,] -0.004745748 1.054376854 0.03973566 0.04577489
[3,] -0.068770957 0.039735657 0.62869160 0.17361860
[4,] 0.026908251 0.045774886 0.17361860 1.27237192
> cov.mat[1:4, 1:4]
[,1] [,2] [,3] [,4]
[1,] 0.856776796 -0.004842599 -0.07017444 0.02745740
[2,] -0.004842599 1.075894748 0.04054659 0.04670907
[3,] -0.070174445 0.040546586 0.64152204 0.17716184
[4,] 0.027457400 0.046709068 0.17716184 1.29833869
>
> cov.mat2 <-nearPD(cov.mat)$mat
> cov.mat2[1:4, 1:4]
4 x 4 Matrix of class "dsyMatrix"
[,1] [,2] [,3] [,4]
[1,] 0.856776789 -0.004842599 -0.07017444 0.02745740
[2,] -0.004842599 1.075894744 0.04054659 0.04670907
[3,] -0.070174444 0.040546586 0.64152203 0.17716184
[4,] 0.027457399 0.046709068 0.17716184 1.29833869
> sum(diag(cov.mat2))
[1] 58.56841