easy · Combinatorial counting and pigeonhole arguments
A trader executes at least one trade on each of 30 consecutive trading days. Let be the (integer) number of trades on day , for .
(a) Suppose the total number of trades over the 30 days is at most 44. Prove that there is a block of consecutive days on which she executes exactly 15 trades.
(b) Now drop the bound of 44. Exhibit a 30-day schedule (still at least one trade per day) on which no block of consecutive days totals exactly 15. What is the smallest possible total number of trades for such a schedule?
Work with cumulative counts. Set and . Because every , the sequence is strictly increasing:
The number of trades on days is exactly , so we must produce a pair with .
Consider the two families of integers
That is integers in total. Each lies in : the first family because , the second because . Sixty integers into boxes: by the pigeonhole principle two of them coincide.
The step a candidate skips is checking which two collide. The are pairwise distinct, and the are pairwise distinct, so no collision happens inside a single family. The equal pair must therefore be cross-family:
and the days total exactly 15 trades.
Avoiding a 15-block means choosing (where is the total) so that no two of these 31 values differ by exactly 15. Equivalently, we want a subset with , containing and , and free of any pair at distance 15.
Partition by residue mod 15. Within one residue class the elements form a chain , and "distance exactly 15" is precisely adjacency along this chain. A distance-15-free selection is thus an independent set in a path, whose maximum size for a path on vertices is . Hence the largest distance-15-free subset of has size .
Write with ; then residue classes have length and the other have length , giving maximum free size
For we have , so , , and the maximum free size is . The same computation gives for every , so a 15-block is forced for all totals up to 59.
For we have , so , , and the maximum free size is
So is exactly the first total that permits a counterexample. An explicit one: take the cumulative set
which has elements, none differing by 15. Its consecutive differences are the daily trade counts:
i.e. 14 days of one trade, one day of 16, 14 more days of one trade, one final day of 16 — that is days and trades. Any window sum equals a difference of two cumulative values, and no two differ by 15, so no block totals 15.
Answer. (a) Such a 15-trade block must exist. (b) The smallest total permitting no 15-block is .
The crude argument in (a) only certifies the conclusion up to a total of , and it is tempting to declare the threshold and hunt for a counterexample at . There is none: the residue/independent-set count shows the true guarantee extends all the way to . The pigeonhole bound is correct but not tight — a useful reminder that surviving the pigeon count is sufficient, not necessary.
medium · Generalized linear models and link functions
Let be independent from a one-parameter exponential dispersion family, with smooth and strictly convex, known dispersion , mean and . Impose a GLM structure: fixed covariates , linear predictor , and a smooth invertible link with .
1. Show that the score for is
2. Now take the canonical link, i.e. . Compute the Hessian of the log-likelihood in . Deduce that (i) the log-likelihood is concave, (ii) the observed information equals the Fisher information, and hence (iii) Newton–Raphson and Fisher scoring produce the same iteration.
3. Take , so , together with the log link (which is not canonical for the Gamma). - (a) Show that the observed information is while the Fisher information is (in particular does not depend on ). - (b) Take with intercept and one covariate, , and three observations with . Suppose that at the MLE the fitted ratios are . Verify these are consistent with the score equations, and compute the matrix .
For a single observation, , so Chain the dependence . Since , we have , and . Hence Summing over gives This is the standard GLM estimating equation: a covariate-weighted sum of residuals, with the weight absorbing both the variance and the link.
With , Differentiate once: (consistent with Part 1, since for the canonical link ). Differentiate again:
The step a candidate can miss: the data have disappeared from the Hessian. Two consequences.
Newton–Raphson updates with the observed Hessian; Fisher scoring updates with the expected one. When the two coincide, so do the iterations. This is exactly the algebraic content of "the canonical link makes Fisher scoring the same as Newton–Raphson."
(a) Here and , so . Plugging into Part 1, Since , we have , so Now the remain. Taking expectations, , so which depends only on the design — not on at all, a pleasant surprise specific to the Gamma–log combination.
(b) Write . The score equations read , i.e. Both hold, so the configuration is a legitimate MLE.
The gap is Entrywise: the entry is ; the entry is (these are exactly the two score equations); the entry is Therefore nonzero, so observed and expected information genuinely differ at the MLE.
The instructive point is why the discrepancy survives at the optimum. The score equations force only the first-moment combinations to vanish; the informations differ through the second-moment combination , and the direction is not among the constraints the score imposes. So the tempting reflex "observed information equals Fisher information at the MLE" is a canonical-link artifact (Part 2), not a general fact. For a non-canonical link the two coincide in expectation but not in realization, which is precisely why Fisher scoring and Newton–Raphson take different steps — and why standard-error formulas must state which information matrix they use.
Two new problems every morning at 8am · every day so far