Multiple Linear Regression using fitlm function

조회 수: 15 (최근 30일)
ANURAG DEEPAK
ANURAG DEEPAK 2020년 1월 18일
답변: Image Analyst 2020년 1월 18일
Hello Sir, why i am not getting the intercept for the other variables?
>> lm=fitlm(X,TAG)
Warning: Regression design matrix is rank deficient to within machine precision.
> In classreg.regr.CompactTermsRegression/checkDesignRank (line 35)
In LinearModel.fit (line 1237)
In fitlm (line 121)
lm =
Linear regression model:
y ~ 1 + x1 + x2 + x3 + x4 + x5 + x6 + x7
Estimated Coefficients:
Estimate SE tStat pValue
__________ __ _____ ______
(Intercept) 0 0 NaN NaN
x1 0 0 NaN NaN
x2 0.00037516 0 Inf NaN
x3 0.00021467 0 Inf NaN
x4 -0.16078 0 -Inf NaN
x5 0.68268 0 Inf NaN
x6 -0.0013354 0 -Inf NaN
x7 0 0 NaN NaN
Number of observations: 5, Error degrees of freedom: 0
R-squared: 1, Adjusted R-Squared: NaN
F-statistic vs. constant model: NaN, p-value = NaN

채택된 답변

Star Strider
Star Strider 2020년 1월 18일
In a linear regression of any sort, there is only one intercept.
  댓글 수: 2
ANURAG DEEPAK
ANURAG DEEPAK 2020년 1월 18일
Then sir how to deal with such situation, 7 independent variable and 1 dependent variable?
Star Strider
Star Strider 2020년 1월 18일
If you want to ssee what the intercepts of the individual variables are, you need to regress them individually. However, the entire idea of a multiple linear regression is to regress the various predictor variables together, to get a unified idea of how they all interact. Note that they do not have to be individual predictors, and can be interaction terms (predictors multiplised together) that distorts the idea of an intercept.
If you want to see what variables best predict the dependent variable, use the stepwiselm function.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2020년 1월 18일
Why not do
coefficients = y \ x;
where y and x are tall matrices that have your observation values listed? (Or maybe it's y/x - I don't know which off the top of my head.)

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by