KatInterview

Modeling Engagement Durations and Rare Event Counts

Statistics & ExperimentsModel answer
MediumModel answerStatistics & Experimentsprobability-distributionssurvival-analysispoisson

Last updated

Derive and validate exponential session-length models and Poisson comment-count models, covering memorylessness, survival diagnostics, and overdispersion.

Modeling Engagement Durations and Rare Event Counts

You are analyzing two aspects of user behavior on a content platform.

Part 1 – Session durations

Assume that at every moment during an active session, a user's probability of leaving is constant — it does not depend on how long they have already been there.

(a) Starting from that constant-hazard assumption, derive the distribution of session durations. State the memoryless property precisely and prove it holds for the distribution you derived.

(b) Describe two empirical checks you would run on logged session data to test whether the constant-hazard assumption actually holds. Be specific about what you would plot, what pattern would confirm the model, and what departures would look like. Account for the fact that some sessions may not have ended by the time the data were collected.

Part 2 – Per-user comment counts

Suppose that every time a user sees a post, they independently decide whether to leave a comment, each time with a small probability p. A given user sees M posts in a time window.

(c) Justify using a Poisson distribution to model the number of comments that user leaves. Give the Poisson parameter in terms of p and M, and state the conditions under which the approximation is reliable.

(d) After fitting the Poisson model to a sample of users, you suspect the fit is poor. Describe the diagnostics you would use to detect overdispersion and excess zeros, and name at least one alternative model for each problem, including how you would decide whether the alternative is warranted.

Hints

Hint 1

For part (a), write the hazard as h(t) = f(t)/S(t) = –d/dt log S(t), set it equal to a constant λ, and integrate with the boundary condition S(0) = 1. The memoryless property then follows directly from the form of S(t).

Hint 2

For part (b), plot log Ŝ(t) against t using the Kaplan–Meier estimator — linearity is what you are looking for. Be careful: a decreasing hazard in pooled data can come from user heterogeneity rather than a violation of per-user memorylessness.

Hint 3

For part (d), start with a simple dispersion check (sample variance vs. sample mean, or Pearson χ²/df from a Poisson GLM) before reaching for a zero-inflated model. Excess zeros sometimes disappear once overdispersion is accounted for with a negative binomial.