In the following example:
x <- rnorm(100) y <- rpois(100, exp(1+x))+10 g1 <- glm(y ~ x, family = Gamma(link = "log")) par(mfrow = c(2,2)) plot(y~x) plot(y,resid(g1)) plot(y,resid(g1$lm))
I am trying to look at the pattern in the predictor variable, i.e. if the model is 'correct' there should be no patterns left in the residuals when plotted against the predictor. From the example shown, which residual am I suppose to use,
resid(g1$lm), or something else?
Same goes when using a
gam, is that
I find this very confusing.