I hope everyone out here is doing well. I am working towards a linear regression model.

I am starting out with 470 variables , most of them are demographics variables by area (zip code). My target variable is website traffic by zip code.

Due to high number of variables and lack of time, I quickly ran stepwise regression, but most of the coefficients were not making sense, which made me believe that the model is mis-specified (one of the short coming of step wise regression).

I am planning to try lasso regression next. If this doesn't work I will have to take a manual approach and cherry pick variables to model, which is time consuming.

Is there anything else I could try. I'll appreciate suggestions. Thank you. I am open to share metadata or sample dataset if interested. Thanks

  • 1
    $\begingroup$ How many rows resp. websites does your model use? Linear models are a nightmare with so many variables as its is virtually impossible to consider suitable interactions, splines etc. Have you looked into modern techniques such as random forests or gradient boosting? Do you already work with a neat cross-validation and test strategy? $\endgroup$
    – Michael M
    Commented Aug 26, 2020 at 6:15
  • $\begingroup$ What is the purpose of your model ? Are you trying to understand what influences website traffic or are you wanting to make predictions of future website traffic ? $\endgroup$ Commented Aug 26, 2020 at 6:40
  • $\begingroup$ Thanks for the replies - @MichaelM Unfortunately I won't be looking into modern techniques like a random forest as I am looking to explain the model. $\endgroup$ Commented Aug 26, 2020 at 14:41
  • $\begingroup$ @RobertLong I am trying to predict what influences web site traffic at geo level (zip code level). I have demographics, household data at the same geo level as the website traffic. $\endgroup$ Commented Aug 26, 2020 at 14:41
  • $\begingroup$ "predict what influences web site traffic" ? That doesn't make sense. You can predict website traffic by building a model using various aproaches. Or you can build a model to understand how the variables in the model influence web site traffic. But you can't build a model to predict what infuences web site traffic $\endgroup$ Commented Aug 26, 2020 at 14:46

1 Answer 1


As mentioned in the comments to the question, you are interested in inference, not prediction - that is, you are interested in how the explanatory variables influence the outcome.

Any kind of stepwise procedure, and any other automated method of variable selection (eg the lasso or other regularised procedure) will not work as it cannot account for bias due to confounding or mediation. The only way to do this is by applying knowledge of the variables, and making assumptions where necessary, about the inter-connectedness of all the variables. See this answer for details:
How do DAGs help to reduce bias in causal inference?

The key point here is that it is important to adjust for confounding, and just as important not to adjust for mediators. A mediator for one causal path, may be a confounder for another. So different models are needed depending on what the "main exposure" is. With 470 variables this will not be an easy task. One approach would be to do a factor analysis, to reduce the dimensionality of the dataset to something more manageable, and then use the factors in a regression model. You can combine both steps with a structural equation model (SEM). In order to do this you will need to indentify the factors in advance, that is, by grouping similar variables together.


Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.