Fitlm and regression equations

3 次查看(过去 30 天)
John Good
John Good 2020-11-30
回答: Aditya Patil 2020-12-22
I am tring to conduct a fitlm equation on two data sets. One is F which is my independant variables and the other is Rdec which is my dependant variable. I am using the equation:
for i=1:funds;
mdl=fitlm(F,Rdec(:,i));
alpha(i,:)=mdl.Coefficients.Estimate(1)
talpha(i,:)=mdl.Coefficients.tStat(1)
end;
But getting results full of NaN's. My Rdec contains cells that are NaN and I cannot figure out how to remove them, could this be the problem? Is it due to the difference in the size of F and Rdec? Or do I have to define certain parts of the equation before I try compute it?
Thanks
  2 个评论
John Good
John Good 2020-11-30
I am getting this error:
Warning: Regression design matrix is rank deficient to within machine precision.
> In classreg.regr/CompactTermsRegression/checkDesignRank (line 35)
In LinearModel.fit (line 1048)
In fitlm (line 121)

请先登录,再进行评论。

回答(1 个)

Aditya Patil
Aditya Patil 2020-12-22
As per my understanding, you are facing issue due to NaNs in the data.
You can consider replacing NaNs with a more appropriate value. Depending on the data, this might be zero, average/mean of rest of the values, or some other default value.

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by