R中的特征值分解

R中的特征值分解,r,matrix,eigenvalue,R,Matrix,Eigenvalue,请原谅这个简单的问题,但如何在R中进行特征值分解?公式是A=VDV^(-1),其中A是一个方阵,V是一个包含A的特征向量的矩阵,D是一个包含A的不同特征值的对角矩阵。感谢您的帮助 下面是一个可复制的示例: ##create the matrix matrixa <- cbind(c(0.589, 0.202),c(0.033, 0.869)) ##This is what I tried but it doesn't seem right (eigen(matrixa)[[2]])*(ei

请原谅这个简单的问题,但如何在R中进行特征值分解?公式是A=VDV^(-1),其中A是一个方阵,V是一个包含A的特征向量的矩阵,D是一个包含A的不同特征值的对角矩阵。感谢您的帮助

下面是一个可复制的示例:

##create the matrix
matrixa <- cbind(c(0.589, 0.202),c(0.033, 0.869))
##This is what I tried but it doesn't seem right
(eigen(matrixa)[[2]])*(eigen(matrixa)$values)*(solve(eigen(matrixa)[[2]]))
##创建矩阵

matrixa您可以尝试
%*%
+
diag

with(
  eigen(matrixa),
  vectors %*% diag(values) %*% solve(vectors)
)

      [,1]  [,2]
[1,] 0.589 0.033
[2,] 0.202 0.869

*
是元素积,而不是矩阵积。太好了。感谢you@ThomaslsCoding!