Multiple linear regression
regress
is useful when you simply need the output arguments of
the function and when you want to repeat fitting a model multiple times in a loop. If
you need to investigate a fitted regression model further, create a linear regression
model object LinearModel
by using fitlm
or stepwiselm
. A LinearModel
object provides more features than regress
.
Use the properties of LinearModel
to investigate a fitted
linear regression model. The object properties include information about
coefficient estimates, summary statistics, fitting method, and input
data.
Use the object functions of LinearModel
to predict responses
and to modify, evaluate, and visualize the linear regression model.
Unlike regress
, the fitlm
function
does not require a column of ones in the input data. A model created by
fitlm
always includes an intercept term unless you
specify not to include it by using the 'Intercept'
name-value pair argument.
You can find the information in the output of regress
using the properties and object functions of
LinearModel
.
Output of regress | Equivalent Values in LinearModel |
---|---|
b | See the Estimate column of the
Coefficients property. |
bint | Use the coefCI
function. |
r | See the Raw column of the Residuals property. |
rint | Not supported. Instead, use studentized residuals
(Residuals property) and observation
diagnostics (Diagnostics property) to find
outliers. |
stats | See the model display in the Command Window. You can find
the statistics in the model properties (MSE and Rsquared ) and by using the anova
function. |
[1] Chatterjee, S., and A. S. Hadi. “Influential Observations, High Leverage Points, and Outliers in Linear Regression.” Statistical Science. Vol. 1, 1986, pp. 379–416.
fitlm
| LinearModel
| mvregress
| rcoplot
| stepwiselm