Clear Filters
Clear Filters

Fitlm and regression equations

3 views (last 30 days)
John Good
John Good on 30 Nov 2020
Answered: Aditya Patil on 22 Dec 2020
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 Comments
John Good
John Good on 30 Nov 2020
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)

Sign in to comment.

Answers (1)

Aditya Patil
Aditya Patil on 22 Dec 2020
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.

Community Treasure Hunt

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

Start Hunting!