KatInterview

Auditing a Dwell-Time Linear Regression Pipeline

Statistics & ExperimentsModel answer
MediumModel answerStatistics & Experimentslinear-regressionmodel-selectionoverfitting

Last updated

Review a colleague's OLS workflow for predicting session dwell time from four predictors, and explain what is wrong, what you would ask, and how you would rebuild it.

A colleague has handed you a modeling workflow for review. Your job is to critique it and say what you would do differently.

Setting

Visitors reach a website by clicking a result in a search engine. The outcome Y is the number of seconds a visitor stays on the site during that session (session dwell time). There are four candidate predictors, X1 to X4. You are not told what they are, and they may be a mix of numeric and categorical features. The sample size is also not given.

The colleague's workflow

  1. Y looks roughly bell-shaped in a histogram, so they decided ordinary least squares (OLS) was appropriate.
  2. They fit every subset of the four predictors, allowing squared terms and all pairwise interactions among them.
  3. They kept whichever model had the best fit on the training data and reported it as final.

What to cover in your answer

  1. Which clarifying questions you would ask before accepting the analysis, including whether the goal is prediction, inference, or causal estimation, and how each goal changes the right approach.
  2. Which assumptions actually matter for OLS and for valid inference, and why the shape of Y's marginal distribution is not one of them.
  3. Ways dwell-time data can break standard linear-model assumptions (skew, zeros, censoring, outliers, dependence).
  4. The problems caused by the exhaustive subset and interaction search, and why "best in-sample fit" is the wrong selection criterion.
  5. The diagnostics you would run instead.
  6. How you would redesign modeling and validation: baselines, data splitting or cross-validation, metrics, and alternatives such as target transformations, GLMs, regularization, robust or clustered standard errors, and tree-based models.

Hints

Hint 1

Count the candidate terms (main effects, squares, pairwise interactions) and the number of models in the search. Then ask what happens to R² and training error whenever a term is added.

Hint 2

Look at what the Gauss-Markov assumptions are about: errors conditional on X, not the marginal distribution of Y. Think of a binary predictor with a large effect and what that does to a histogram of Y.

Hint 3

Think about how the data were generated: bounces, timeouts, last-page time, repeated visits by the same user, and features recorded after the click. Each suggests a specific diagnostic or an alternative model.

Hint 4

For the redesign, think in this order: define the goal, set a simple baseline, split by user and time, choose a suitable target model, control complexity with penalization or CV, and report honest out-of-sample metrics.