= Solution
The first two commands create <vectors> of observed successes and corresponding numbers of trials. The next two create the class labels and convert them into an R <factor>, so the labels are treated categorically. The final command fits a <grouped-binomial logistic regression>, using the proportions as responses and trial totals as binomial weights, and prints its summary. The model is $\log[\pi_i/(1-\pi_i)]=\beta_0+\beta_b\mathbf1_{\{S_i=b\}}$, with class a as reference.
The intercept estimates the <log odds> in class a. Its value corresponds to <probability> $39/287\approx0.1359$. The class-b coefficient is the estimated increase in <log odds>, about $0.4999$, so the fitted <probability> in class b is $35/170\approx0.2059$ and the estimated <odds ratio> is $e^{0.4999}\approx1.6485$. The printed <standard errors> measure uncertainty in these estimated coefficients. The z values are estimate divided by <standard error>: the intercept tests whether the class-a <probability> is $1/2$, while the class-b z value tests equal class <probabilities>. The two-sided normal-reference <P-value> for the latter is about $0.051$, so it is just above a conventional $5\%$ threshold; this is a borderline result rather than strong evidence of a class effect.
The residual <deviance> compares the fitted two-parameter model with the four-probability saturated model. Its value $1.9369$ on $4-2=2$ residual degrees of freedom is small relative to a $\chi_2^2$ reference, with approximate tail <probability> $e^{-1.9369/2}\approx0.380$. There is no evidence of lack of fit by that check. Four <Fisher scoring> iterations were needed for numerical fitting. These interpretations presume independent binomial counts and the usual large-sample approximations; weights here encode trial counts, not extra independent observations.
Back to article page