medium · Poisson processes and inter-arrival times
Orders hit your book according to a homogeneous Poisson process of rate per minute. You want to slip a large order in during a lull — a time interval of length (minutes) during which no order arrives. Define to be the first time at which such a lull completes: formally, the smallest for which the interval contains no arrival. Let be the number of orders that arrive strictly before the lull completes (i.e. in ).
Do not try to integrate over configurations of arrivals in . Condition on the first inter-arrival time and exploit the memorylessness (strong Markov / independent increments) of the Poisson process:
This renewal-at-each-arrival is the step a candidate skips. Everything below is just executing it.
Let . Conditioning on the first arrival:
The counts the order that just arrived; the is the independent restart. Solving,
Equivalently: is geometric, counting "short" gaps (each with success probability of being the terminating long gap), so .
Let . Condition on again. If the lull completes at ; if we have burned time and restart, so with an independent copy:
Use and, by parts,
Substituting, the terms cancel:
Hence , giving
Note the clean relation . That is not a coincidence: the wasted "short" gaps sum to in expectation, and adding the final recovers ; the 's cancel exactly.
Here , so .
| Quantity | Formula | Value |
|---|---|---|
| orders | ||
| min | min |
The qualitative punchline worth internalizing: waiting for a fixed quiet window costs time that grows exponentially in , not linearly. A tempting wrong answer is to reason "a gap of length is -likely, and I get a fresh gap every , so " — right order of magnitude in the blow-up but the wrong constant; the exact answer is .
Answers: numerically orders and minutes.
medium · Model selection: AIC, BIC and cross-validation bias
Let be i.i.d.\ with known. Consider two nested candidate models for the mean:
For a fitted model define the Gaussian log-likelihood , and the criteria and , each minimized over the two models. Write , , .
(a) Show that AIC selects iff and BIC selects iff . Assuming the true mean is , give the exact probability that AIC overfits (selects ) as a closed form, evaluate it numerically, and show the corresponding BIC probability tends to ; give its leading-order rate in .
(b) Now score the two models by leave-one-out cross-validation (LOOCV): for each refit the mean on the other points and predict , summing squared prediction errors. Compute both LOOCV scores in closed form and reduce the rule "LOOCV prefers " to an inequality in and .
(c) Under , give the exact probability that LOOCV overfits, in closed form, and identify its limit. Compare the outcome to AIC and to BIC.
Under the MLE is , giving . Under , , so . Using the decomposition ,
Thus AICAIC iff , i.e. . Likewise BIC selects iff . The generic fact behind this: twice the fitted log-likelihood gap of a one-parameter extension equals the score/Wald statistic, here exactly .
Distribution of under . With , , so exactly (no asymptotics needed here). Hence
Numerically , , so the probability is . This does not shrink with : AIC overfits by one parameter with probability regardless of sample size.
For BIC, . Using the chi-square tail with (so ),
BIC is consistent: it discards the spurious parameter with probability .
For the prediction is the constant irrespective of which point is held out, so its LOOCV score is .
For , the held-out mean is . The one-line computation people miss is the residual identity:
Therefore
LOOCV prefers iff , i.e. , which rearranges to
So LOOCV uses the same statistic as AIC, but against a random, data-dependent threshold rather than the fixed value .
Under we need . Two facts make this exact:
Hence , and the event is
Therefore
As , and the threshold , so this probability — exactly the AIC overfit rate.
Conclusion. LOOCV is asymptotically equivalent to AIC here: both keep a spurious parameter with limiting probability , and neither is consistent. BIC alone drives the overfit probability to (at rate ). The slight finite- conservatism of LOOCV — its expected threshold is , just above AIC's — vanishes as .
The tempting wrong answer is to declare cross-validation "honest" and therefore consistent for model selection. It is honest as an estimator of prediction error, but choosing the model with the smallest CV error is a different task: the effective complexity penalty LOOCV imposes is per parameter, matching AIC, not the needed for selection consistency. The identity above makes the equivalence exact rather than merely asymptotic in spirit, and it rests entirely on the independence of and .
Two new problems every morning at 8am · every day so far