I runned two GLMs using the same dependent and independent variables, but modelling each analysis according a different type of distribution. Then, I compared its AIC values to find what distribution best fits the data:
> glm_1 <- glm(data$Y ~ data$X, family = "gaussian")
> glm_2 <- glm(data$Y ~ data$X, family = "Gamma")
> AIC(glm_1, glm_2)
df AIC
glm_1 3 38.52803
glm_2 3 26.09031
As you can see, the Gamma distribution better explains my data distribution. However, when performing a Shapiro-Wilk test, I got an indication that there is normality in Y
:
> shapiro.test(data$Y)
Shapiro-Wilk normality test
data: data$Y
W = 0.88314, p-value = 0.1417
When viewing the distribution of Y
on a histogram and on a Q-Q plot, I couldn't convince myself that the distribution is normal:
hist(data$Y, main = " ", xlab = "X")
qqnorm(data$Y)
qqline(data$Y)
According to the results above, would it be incorrect if I performed a simple linear regression of Y ~ X
, or would it be more appropriate to make a GLM considering the Gamma distribution?