Skip to content
Prev 377002 / 398502 Next

GLM Model Summary

Hi,

Presuming that you are talking about the glm() function, as there is no GLM package as far as I can see, R model objects have a structure that can be viewed using the str() function. The help for this function can be viewed using:

   ?str

You can then use:

  str(summary(YourModelObject))

That will give you some insights into the model object components and that same str() function is valuable for investigating other objects as well.

That being said, R's model objects typically have 'extractor' functions to make it easy to obtain commonly used components of the model object, which can be complicated.

The R manual "An Introduction to R", has a section on some of these:

    https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Generic-functions-for-extracting-model-information <https://cran.r-project.org/doc/manuals/r-release/R-intro.html#Generic-functions-for-extracting-model-information>

Thus, for example, using:

  coef(summary(YourModelObject))

will return the matrix of coefficients and related parameters from the summary model object.

Once you have that matrix object, you can write it out to a CSV file using ?write.csv, where the CSV file can then be opened with or imported into Excel.

So the steps might be along the lines of:

  my.coef <- coef(summary(YourModelObject))

  write.csv(my.coef, file = "MyCoefficients.csv")


The R Data Import/Export manual:

  https://cran.r-project.org/doc/manuals/r-release/R-data.html <https://cran.r-project.org/doc/manuals/r-release/R-data.html>

has some insights into pathways for getting data to and from R, including some packages that can directly write Excel files. You may wish to review that manual as well.

Regards,

Marc Schwartz