# Tag Info

## Hot answers tagged logistic

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 ...

3

Unbalanced classes are almost certainly not a problem, and oversampling will not solve a non-problem: Are unbalanced datasets problematic, and (how) does oversampling (purport to) help? Do not use accuracy to evaluate a classifier: Why is accuracy not the best measure for assessing classification models? Is accuracy an improper scoring rule in a binary ...

2

Bernoulli/binomial indicates that the outcome is binary, but you could use different link functions, like probit or logit. The latent/unobserbed variables (math aptitude and school quality) are continuous. The probit or logit choice rarely matters in practice in that the marginal effects will be similar. The coefficients, of course, will be quite different.

1

There is no difference. Both are correct (as can be seen by the fact that the outputs are the same). One treats the data as 10 Bernoulli data and the other treats them as 2 binomial data constituting, collectively, 10 Bernoulli trials.

1

Many thanks to R Carnell for providing the derivation. To increase my understanding, I ran some simulations to validate the theoretical results. First some helper functions. import numpy as np import matplotlib.pyplot as plt from scipy.stats import norm from scipy.stats import bernoulli # expectation of Y given X -- logistic model def EYX(x,beta0,beta1): ...

1

This notation is not perfect, but it helps keep the conditioning straight: $$E(Y|X=x) = \frac{1}{1+e^{-(\beta_0 + \beta_1 x)}}$$ Since $X \sim N(0,1)$ and $N(\mu, 1)$, $$f(X|Y=1) = \frac{1}{\sqrt{2 \pi} \sigma} e^{\frac{-(x-\mu)^2}{2 \sigma}} = \frac{1}{\sqrt{2 \pi}} e^{\frac{-(x-\mu)^2}{2}}$$ $$f(X|Y=0) = \frac{1}{\sqrt{2 \pi}} e^{\frac{-x^2}{2}}$$ ...

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