log-linear modelling: transforming y variable

I am conducting a study on graphical log-linear modelling and my aim is to fit a log-linear model to data.

I am using R studio to carry out the analysis and I am using the glm function.

When first analysing the data, I checked whether the y variable is normal however it is not (see attached qq plot). Then using the Box–Cox function, it looks like there is a tiny range of lambda values for the transformation (around 0.2).

Does anyone have any suggestions? • Regression is not about the marginal distribution of your outcome; its about the conditional distribution. Looking at the qqplot of the raw outcome won't tell you anything. Feb 29 '20 at 22:09
• What are you trying to do with what data? Feb 29 '20 at 22:11
• @MichaelM I'm trying to fit a log-linear model to it using techniques of AIC to simplify (or in terms of graphical modelling edge removal). The data is here kaggle.com/hmavrodiev/london-bike-sharing-dataset - note that my supervisor said it was ok to categorise the continuous data using quantiles for the purpose of this project Feb 29 '20 at 23:34
• @DemetriPananos dont you need to check for normality in order to fit a model? Feb 29 '20 at 23:34
• @Ng123 you need to check for normality in the residuals, not in the raw outcome. Mar 1 '20 at 0:45

Everyone gets this wrong about regression: The conditional distribution of the outcome is assumed to be normal, not the marginal distirbution. This means that looking at qqplots of the outcome is not informative. Let me demonstrate.

Here is a bimodal distribution. Ew, yuck, definitely not normal. We can't do regression on this...right? Here is the summary of the regression. High r squared, low RSS, what gives? We made the erroneous decision that the marginal distribution of y is what matters.

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 10.00101    0.02292  436.35   <2e-16 ***
x            1.99321    0.03151   63.25   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.4974 on 998 degrees of freedom
Multiple R-squared:  0.8004,    Adjusted R-squared:  0.8002
F-statistic:  4001 on 1 and 998 DF,  p-value: < 2.2e-16

Here is how I made the data

x = rbinom(1000,1, 0.5)
y = 10+2*x + rnorm(1000,0, 0.5)

If we broke down this mathematically, the data are distributed as follows

$$y\vert x \sim \mathcal{N}(10 + 2x, 0.5)$$

The distribution of $$y$$ is conditional on $$x$$. This is where the assumption of normality comes from. If I knew $$x$$, then $$y$$ would be normal. But if I ignore x dependence then I get a different distribution, one which regression makes no assumptions about.

Fit your model, then assess the normality of the residuals. That is how you check if this assumption is respected. Then, you can worry about box-cox transforming things.