15

If you're trying to generate data from logistic regression's assumed data generating mechanism, your code does not do that. Logistic regression's data generating mechanism looks like $$ \eta = X\beta$$ $$ p = \dfrac{1}{1+e^{-\eta}}$$ $$ y \sim \operatorname{Binomial}(p, n) $$ What it looks like you're trying to do is create a linear regression in the log ...


Only top voted, non community-wiki answers of a minimum length are eligible