what are the differences between regress and fitlm?

40 views (last 30 days)
What are the differences between regress and fitlm?
  2 Comments
Mohammad Sami
Mohammad Sami on 7 Jul 2020
Copied verbatim from Matlab documentation:
Alternative Functionality
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.

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!