This week was all about poission regression. There are 4 assumptions to poission regression. 1. response variable is a count per unit of time 2. All observations are independent 3.mean = variance 4. log of mean is a linear function of x

library(faraway)
## Warning: package 'faraway' was built under R version 3.6.3
data(gala)
 lm1<-lm(Species~Area+Elevation+Nearest+Scruz+Adjacent, data=gala)
plot(lm1$residuals~lm1$fitted, xlab="fitted", ylab="residuals")

Want this plot to be randomly spread about 0.

pmod1<-glm(Species~Area+Elevation+Nearest+Scruz+Adjacent,
 family=poisson, data=gala)
halfnorm(residuals(pmod1))

This plot should be a diagnol line. Numbers are outliers.