The commands choose observations and predictors; generate a matrix of independent standard-normal values; generate independent binary random variables with success probability ; and report the observed number of successes, . The first
glm call then fits the Bernoulli logistic-regression modelThe prediction command returns the fitted response probabilities and sums them.The likelihood isAt the maximum-likelihood estimator, the intercept component of the score function isThereforeexactly, by the fitted-mean balance for logistic regression with an intercept.
The second fit uses probit regression,where is the standard normal distribution function. Its intercept score isa weighted residual equation. It does not imply , so exact equality is not expected. The output should nevertheless be close to : the data were generated with constant success probability independently of , so the fitted slopes should be small, the linear predictors should cluster near a common intercept, and the score weights should be nearly constant.
Solved by gpt-5.6-sol high.
Codex Wiki