= Solution
`factor(day)` treats the nine days as categorical rather than imposing a numerical time trend. `rep(400,27)` supplies the number of trials for every dish, and `prop` is the observed surviving proportion. The contrast setting uses <treatment coding> with day 1 as reference; the ordered-factor <polynomial> option is unused. Supplying these proportions to `glm` with the binomial family and weights $400$ gives precisely the <grouped-binomial logistic regression> <likelihood> for the counts. The weights represent trial counts, not additional independent dish observations. The binomial family's default link is the <logit link> and its dispersion is fixed at $1$.
Let $Y_{ij}$ be survivors in dish $j=1,2,3$ on day $i=1,\ldots,9$. Both fitted models assume independent $Y_{ij}\sim\operatorname{Bin}(400,p_i)$. Model 1 specifies
$$
\log\frac{p_i}{1-p_i}=\mu\qquad\text{for every day},
$$
so it has one common probability and one fitted coefficient. Its estimated probability is the total surviving count divided by the total trial count, $\widehat p=3539/10800\simeq0.327685$.
Model 2 specifies
$$
\log\frac{p_i}{1-p_i}=\mu+\alpha_i,\qquad\alpha_1=0.
$$
It has nine coefficients and allows a separate probability for each day, while retaining a common probability for the three dishes within that day. The MLEs are the day totals divided by $1200$. In day order they are
$$
\widehat p_i=(0.49000,\ 0.28000,\ 0.18417,\ 0.31667,\ 0.36583,\ 0.31500,\ 0.46833,\ 0.21167,\ 0.31750).
$$
The intercept is the first day's logit, and each other coefficient is its day's logit minus that reference. These are additive effects on log odds, not additive changes in survival probability.
The <analysis of deviance> adds the eight day indicators after an intercept-only model. Its residual <deviance> compares a fitted model with the <saturated statistical model> assigning one separate probability to each of the $27$ dishes. For fitted dish probabilities $\widehat p_{ij}$, the <binomial deviance> is
$$
D=2\sum_{i,j}\left\{Y_{ij}\log\frac{Y_{ij}}{400\widehat p_{ij}}+(400-Y_{ij})\log\frac{400-Y_{ij}}{400(1-\widehat p_{ij})}\right\}.
$$
The binomial scale is one, so this is also <scaled deviance>. The reported decrease measures the extra fit provided by day. There are $27$ observational units for these residual <statistical degrees of freedom>, not $10800$ separately fitted Bernoulli responses.
Back to article page