1
$\begingroup$

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
$\endgroup$
3
  • $\begingroup$ When the SW-test on residuals has such a large p-value as $0.1$ you should be pleased: those residuals are pretty close to normally distributed! $\endgroup$
    – whuber
    Commented Jul 10, 2014 at 15:04
  • $\begingroup$ Really sorry, the p-value is 0.02 i.e. residuals are not normally distributed!! $\endgroup$ Commented Jul 10, 2014 at 15:05
  • $\begingroup$ Although this particular point is not relevant to the general question you ask, it might be worth mentioning that applying any formal test of normality to regression residuals is usually not a good idea. You should instead be looking at appropriate diagnostic plots to find out how the residuals depart from normality and evaluating them based on how sensitive your formal testing will be to departures from normality. Many tests in the least squares context are rather insensitive to departures, especially when the residual distribution is approximately symmetric. $\endgroup$
    – whuber
    Commented Jul 10, 2014 at 15:08

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.