Orongo
Orongo

Reputation: 295

How to get standard error from fitlm command

I am using fitlm for my regression and am using the command lm.Coefficients.Estimate(1) to the estimate for the intercept. How can I do the same but for the standard error?

Upvotes: 0

Views: 1041

Answers (1)

Suever
Suever

Reputation: 65440

fitlm returns a LinearModel object which has a number of properties to determine the goodness of the fit. All of these properties can be accessed using the dot notation.

You can compute the standard error for each coefficient from these properties as shown in the documentation.

standardErrors = diag(sqrt(lm.CoefficientCovariance));

Update

If you want the overall standard error of the fit, that is typically defined as the square root of the mean squared error. We can compute that:

stdErr = sqrt(lm.MSE);

Upvotes: 1

Related Questions