Search code examples
rsurvey

Extracting the dispersion parameter in a GLM output


From here, a svyglm model's summary includes a line like

(Dispersion parameter for gaussian family taken to be 28.35031)

If my linear model object is my_lm, how do I extract its dispersion parameter? Something like my_lm$dispersion. I am trying to extract this value as a variable, not just print it.


Solution

  • You can do:

    fit2 <- glm( Sepal.Length ~ ., data=iris )
    summary(fit2)$dispersion
    [1] 0.09414226
    

    Notice that the dispersion is in the summary object and not in the model object