-
Book Overview & Buying
-
Table Of Contents
Mastering Scientific Computing with R
By :
We just saw how to fit our data to a model using linear regression. However, as we just saw, in order for our model to be valid, it must make the assumption that the variance is constant and the errors are normally distributed. A generalized linear model (GLM) is an alternative approach to linear regression, which allows the errors to follow probability distributions other than a normal distribution. GLM is typically used for response variables that represent count data or binary response variables. To fit your data to a GLM in R, you can use the glm() function.
GLM has three important properties:
The error structure informs us of the error distribution to use to model the data and is specified by the family argument. For example, you might want to use a Poisson distribution to model the errors for count data and a Gamma distribution to model data showing a constant coefficient of variation as follows:
glm(y ~ z,...
Change the font size
Change margin width
Change background colour