I'll use the data azdrg112
from COUNT
package. The los
will be the response variable while the remaining three variables gender
, type1
and age75
are the explanatory variables. Here is the plot of the response
install.packages('COUNT')
library(COUNT)
data("azdrg112")
barplot(table(azdrg112$los))
The responses seem to be drawn from the Poisson distribution. I modelled it and calculated the absolute mean square error as
pois_model = glm(los ~ ., data = azdrg112, family = poisson)
pois_pred = predict(pois_model, azdrg112, type = 'response')
mean(abs(pois_pred - azdrg112$los)) # 2.330834
I then tried using Linear Regression
gaus_model = glm(los ~ ., data = azdrg112, family = 'gaussian')
gaus_pred = predict(gaus_model, azdrg112, type = 'response')
mean(abs(gaus_pred - azdrg112$los)) # 2.343426
I expected that the Poisson Regression would be a better fit then yield a smaller error but why both models output the same error?
badhealth
, also in the same package but it's still the same problem. $\endgroup$los ~ .
doesn't add the interactions. Fit the saturated model withlos ~ gender * type1 * age75
and you'll get the same predictions with bothglm
with the poisson family and with lm even though the coefficient estimates are not the same (because their interpretation in the models is different). $\endgroup$