How to extract the Std. Error of a linear regression model by GLM?

You can use stderror:

julia> using GLM

julia> x = rand(10); y = rand(10);

julia> res = lm(@formula(y~x), (;x, y))
StatsModels.TableRegressionModel{LinearModel{GLM.LmResp{Vector{Float64}}, GLM.DensePredChol{Float64, LinearAlgebra.CholeskyPivoted{Float64, Matrix{Float64}, Vector{Int64}}}}, Matrix{Float64}}

y ~ 1 + x

Coefficients:
─────────────────────────────────────────────────────────────────────────
                 Coef.  Std. Error      t  Pr(>|t|)  Lower 95%  Upper 95%
─────────────────────────────────────────────────────────────────────────
(Intercept)   0.768012   0.0978733   7.85    <1e-04   0.542315  0.993708
x            -0.455953   0.218396   -2.09    0.0703  -0.959576  0.0476696
─────────────────────────────────────────────────────────────────────────

julia> stderror(res)
2-element Vector{Float64}:
 0.09787333346669594
 0.21839629429830254

Edit: see here for more access methods: Examples · GLM

2 Likes