- predict
- random
- feval
What are Estimated coefficients parameters (Estimate, SE, tStat, pValue) when we do the linear regression model by the command fitlm?
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
If you try the matlab example about linear regression by the following code:
load carsmall
tbl = table(Weight,Acceleration,MPG,'VariableNames',{'Weight','Acceleration','MPG'});
tbl(1:5,:)
lm = fitlm(tbl,'MPG~Weight+Acceleration')
It will generate the following answer:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/168381/image.png)
It means that MPG is linearly proportional to weight and acceleration and a constant value. But I don't understand how? I mean I don't understand what these parameters (Estimate, SE, tStat, pValue) tell me? How should I make the function of the out put with the parameters?
Many thanks in advance,
0 commentaires
Réponse acceptée
dpb
le 18 Oct 2017
Modifié(e) : dpb
le 19 Oct 2017
Follow through the documentation -- click on the mdl active link of the LHS output variable in the Description section which will take you to the Output Arguments section. Then click on the Linear model link that takes to the description of the LinearModel class and associated methods. There, there is an explanation of the displayed output.
Also, to use the model, there's link to Predict or Simulate Responses to New Data as an example on the fitlm page.
In short, there are three possible ways...
which are all illustrated at the above example.
For some reason TMW did not implement the linear model class in the Statistics TB similarly to the Curve Fitting TB fit object, such that simply invoking the object with arguments returns a predicted value for those inputs. Why not is anybody's guess; just another one of the cases where the development teams seem disjointed and leave inconsistent user interfaces.
All in all, the CF TB is more convenient in that manner; the Stat TB implementation will provide the additional statistical information that you much compute on your own with CF TB ... which to use depends on what your output needs are (and which TB'es you have installed, of course).
ADDENDUM
The model is of form
MPG ~ 1 + Weight + Acceleration
~ Intercept + Weight + Acceleration
so from the output table you've got the coefficients of the fit are the Estimate for each of the three terms. The other columns are the estimate of error of that coefficient and the t-statstic for testing the hypothesis the coefficient could be zero and the probability of randomly having that particular value. That stuff is what is in a standard statistics text on regression and is somewhat outside the scope of Matlab other than to tell you what the terms are as far as more definition. But, through the other links, there is some description in the example on interpretation given in other comment below.
Again, if you are just wanting a fit and to compute some additional newer values for estimates, the Curve Fitting TB cfit is somewhat simpler to use in that manner. Why TMW insists on having all these overlapping functionalities that have so wildly inconsistent interfaces remains a major mystery (well, not so much a mystery but aggravation).
The other functions are the ways to use the model; didn't really have to do with what the printed output table means...
2 commentaires
dpb
le 19 Oct 2017
Oh, the documentation is a piecemeal thing, indeed...but while the content is essentially the same, the organization of the page is different in current release than the R2014b I've installed...now there's a set of Examples and How To links at <multiple-linear-regression>. The one of particular interest is <understanding-linear-regression-outputs>. I was able to get there from the other direction on installed doc here but not via that route directly on the current set of docs at the TMW site...
I agree, should be direct link to the description from the output link. I suppose they presume folks using the Stats TB are statistically-aware already.
Unless you have real need for the extra statistics, I'd probably revert to Curve Fitting TB as easier to use.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!