求教:因子分析factoran函数总提示错误!。

用因子分析时候老提示错误:
matlab2014a提示如下:
错误使用 factoran (line 185)
The covariance/correlation matrix must be square, symmetric, and positive definite.
matlab2010b提示如下:
??? Error using ==> factoran at 200
The covariance/correlation matrix must be positive definite.
但是我的数据明明都是合适的,用协方差计算代码如下:
A=cov(X,1);
labmda=factoran(A,4,'xtype','cov');
换成用原始数据计算如下:
labmda=factoran(X,4,'xtype','data‘);
出现同样错误。
搞了两天了也没弄明白到底哪里出了问题。
请大家帮忙看看是怎么回事,不胜感激!
谢谢,原始数据在附件中。

 採用された回答

spjpesr
spjpesr 2023 年 5 月 23 日

0 投票

因为你的X矩阵不是满秩的(rank(X)=55),所以协方差矩阵不是正定,而错误提示里要求协方差正定。
我试了一下,可以先用主成分分析提出前55个成分,再用因子分析:
[Coef,Score]=princomp(X'); %应该以样本为行,变量为列,所以X要转置一下
labmda=factoran(Score,4,'xtype','data');

その他の回答 (0 件)

カテゴリ

タグ

質問済み:

2023 年 5 月 23 日

回答済み:

2023 年 5 月 23 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!