Lets say I have continuous y and x variable and I run a linear regression:
mdl1<-lm(y ~ x)
A generalised linear model should also give me the same parameters value if I do not specify the error structure (i.e. by default it assumes that the error structure is Gaussian)
mdl2<-glm(y ~ x)
Both the above model should give me the same results (since in the mdl2
, by default the error structure is gaussian)
My question is if the residuals are not normally distributed in the mdl1
(i.e. I do a shapiro.wilk test on mdl1
residuals, which gives me a p-value of 0.02),
shapiro.test(rstandard(mdl1)
then in the glm what error family do I specify considering both y and x are continuous. What my understanding was I can specify family=poisson
or family=binomial
if my response variable was either count or proportion.
mdl3<-glm(y ~ x,family="poisson") # when y is count data
mdl4<-glm(y ~ x,family="binomial") # when y is proportion data
But in case of response variable being continuous and errors not normally distributed what error structure do I need to give?
mdl5<-glm(y ~ x, family=?????) # y is continuous data