问题描述:

This question already has an answer here:

Extract standard errors from glm

3 answers

You can calculate this as the square root of the diagonal elements of the unscaled covariance matrix output by `summary(model)`

```
sqrt(diag(summary(model)$cov.unscaled)*summary(model)$dispersion)
# (Intercept) x
# 2.0600893 0.4000937
```

For your model, the dispersion parameter is 1 so the last term (`summary(model)$dispersion`

) could be ignored if you want.

To get this unscaled covariance matrix, you do

```
fittedVals = model$fitted.values
W = diag(fittedVals*(1 - fittedVals))
solve(t(X)%*%W%*%X)
# (Intercept) x
# (Intercept) 4.2439753 -0.7506158
# x -0.7506158 0.1600754
```