Applying the Gaussian model for generalized linear regression

A generalized linear model (GLM) is a generalization of linear regression, which can include a link function to make a linear prediction. As a default setting, the family object for glm is Gaussian, which makes glm perform exactly the same as lm. In this recipe, we first demonstrate how to fit the model to data using the glm function, and then show that glm with a Gaussian model performs exactly the same as lm.

Getting ready

You need to have completed the previous recipe by downloading the house rental data into a variable, house. Also, you need to fit the house rental data into a multiple regression model, fit.

How to do it…

Perform the following steps to fit the generalized linear regression ...

Get R for Data Science Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.