# Data transformation to deal with heteroscedacity

I am trying to build a linear regression model of the data which generally looks like this: Certainly due to the exponential (I guess) nature of the data, I have tried to do a logarithmic transformation of the 'filmweb votes' variable, to obtain a model looking like that: First issue is this gives me heteroscedacity among residuals, as the entry data clearly does not hold the homoscedacity assumption. I know heteroscedacity does not make a bias in coefficient estimates. However I would like to used it to build a more complex multiple regression model which includes interaction effect and I am afraid that heteroscedacity can affect the significance of the moderation effect in a multiple regression model. Should I be concerned about it?

Secondly, there is also a clear 'polynomial' pattern left in the logarithmized data, and in residuals as well, which suggest there could be a better transformation to use, to fit the data to linear model. Is there a way to find it?

Looks like a log transform was a sensible approach here.

Heteroscedacity can be caused by "missing" variables in the model. You clearly know the genre of the film, does adding this into the model help? Are there any other variable you have?

Also, I think that if a film started off with low ratings that's not going to attract views, whereas if a film has high initial rating then this might increase the number of views. You could accept that the data are heteroscedastic and build a model which accounts for this.

E.g.

$$\log(y) \sim N( \beta_0 + \beta_1 \log (x) , \sigma^2 (x) )$$ $$\log \sigma^2 (x) = \alpha_0 + \alpha_1 x$$

• Actually there is also a 'director's rate' variable and 'mean rate of main actors' variable. Both seem to improve the R square in the model. There is also statistically significant moderation effect which exist between some pairs of variables. I am trying to make it optimal but not 'overfitted' and 'over complex'. I think robust methods could be too 'harsh'. I thought about eliminating outliers of the above data via Mahalanobis or cook's distance, which as a result could reduce the heteroscedacity effect a bit. – huberttt Jun 4 '20 at 18:45
• They will improve the R^2 automatically (theres lot of info elsewhere on why R^2 isnt great). If the two variables you mentioned eliminate/reduce the hetroscedacity then I'd say that's a valid reason to include them. You can look at AIC to help choose variables and avoid over fitting – jcken Jun 4 '20 at 20:01
• Well, after including all the variables in the model, and logarithmic transform the R^2 is 0.75 to 0.8 in a multiple regression model, depending on whether i'm including moderation effect, looking on a residual plot I am not sure if this should be a concern. !Valid XHTML – huberttt Jun 4 '20 at 20:52
• Qq plot is OK but not great. I can also see a step change in variance when the fitted value is about 6.7. It's also suddenly occurred to me that the response is "rate" possibly a rating? Does it have a maximum possible value? – jcken Jun 4 '20 at 21:08
• Yes, the maximum value (theoretically) is 10. The maximum value in the data set is 8,77. – huberttt Jun 4 '20 at 21:26