MATH333: Workshop Week 18

In R, the glm command evaluates the maximum likelihood estimates of the co-efficients in the linear predictor in a generalised linear regression model. The glm command is highly versatile in that we can use this command to fit simple linear regression, Poisson regression and logistic regression models amongst others.

  • formula – An equation of the form y~x stating that the responses y is to be modelled in terms of the linear predictor containing x. Note that symbol ‘~’ is used in this statement.

  • data – A data frame containing the responses and covariates for the model. The column names of the data frame should correspond to the names provided in the formula above.

  • family – The name of the exponential family distribution to define which type of regression model to fit:

    • gaussian – Simple linear regression

    • poisson – Poisson regression

    • binomial – Logistic regression

For more information on how to use the glm command, please refer to the help file by typing ?glm on the command line and click on the links there in.