# Does GLM return an estimate for the error term (residual standard deviation)?

**URL:** <https://discourse.julialang.org/t/does-glm-return-an-estimate-for-the-error-term-residual-standard-deviation/79614>\
**Category:** Statistics\
**Tags:** question, statistics, glm\
**Created:** [April 18, 2022, 1:22am UTC](https://discourse.julialang.org/t/does-glm-return-an-estimate-for-the-error-term-residual-standard-deviation/79614 "2022-04-18T01:22:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [April 18, 2022, 1:22am UTC](https://discourse.julialang.org/t/does-glm-return-an-estimate-for-the-error-term-residual-standard-deviation/79614/1 "2022-04-18T01:22:32Z")

</div>

I was under the impression that if I called `lm(@formula(y~x),data)` from the GLM.jl package was fitting a simple linear regression of the form:

y=a+bx\_i+\epsilon\_i

The results from the regression being:

\hat{y}=\hat{a}+\hat{b}x

Which is our linear predictor. But we want to predict a value we have to use:

\hat{y}=\hat{a}+\hat{b}x+\epsilon\_i

Why doesn’t lm return an estimate for error (\epsilon\_i) in the summary of coefficients? Isn’t this an important part of the regression analysis? R returns the estimate as the auxiliary parameter. For a least squares regression wouldn’t this estimate just be the standard deviation of the residuals? Is there any way to access this information without just creating a helper function to calculate that value on my own? Im probably just missing something very dumb!

---

<div class="post-metadata">

**Author:** ![palday](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palday/32/12640_2.png) [@palday](https://discourse.julialang.org/u/palday)\
**Post date:** [April 18, 2022, 3:31am UTC](https://discourse.julialang.org/t/does-glm-return-an-estimate-for-the-error-term-residual-standard-deviation/79614/2 "2022-04-18T03:31:58Z")

</div>

GLM.jl doesn’t report it as part of the model summary, but you can extract it for a model with [`GLM.dispersion`](https://juliastats.org/GLM.jl/stable/api/#GLM.dispersion).

If you think that this should be part of the default output, please open an issue.

Also, if you want to predict a value, see [`GLM.predict`](https://juliastats.org/GLM.jl/stable/api/#StatsBase.predict), which can also provide prediction intervals, taking the various uncertainties in the model into account.

---

<div class="post-metadata">

**Author:** ![charperflow](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/charperflow/32/22252_2.png) [@charperflow](https://discourse.julialang.org/u/charperflow)\
**Post date:** [April 18, 2022, 1:48pm UTC](https://discourse.julialang.org/t/does-glm-return-an-estimate-for-the-error-term-residual-standard-deviation/79614/3 "2022-04-18T13:48:57Z")

</div>

This is exactly what I was looking! I guess I should have looked more closely at the documentation, but thank you for pointing it out anyway 🙂
