Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separated coefficients estimated in Poisson model #529

Open
laszloda opened this issue Sep 23, 2024 · 0 comments
Open

Separated coefficients estimated in Poisson model #529

laszloda opened this issue Sep 23, 2024 · 0 comments

Comments

@laszloda
Copy link

laszloda commented Sep 23, 2024

Hi,

First, thank you very much for the package!

The potential issue I found is the following: I generated a data set with two dummies D1 and D2 and an outcome variable, Y, which is always 0 when D2==1; otherwise Y follows a poisson distribution.

set.seed(123)
n <- 10000

D1 <- rbinom(n, 1, 0.5)  # D1 ~ Bernoulli(0.5)
D2 <- rbinom(n, 1, 0.3)  # D2 ~ Bernoulli(0.3)

Y <- rep(0, n)
lambda_values <- exp(D1)
idx <- which(D2 == 0)
Y[idx] <- rpois(length(idx), lambda_values[idx])

data <- data.frame(D1 = D1, D2 = D2, Y = Y)

I run two estimations feglm(fml=as.formula('Y ~ D1 + D2'), data = data, family = "poisson") and feglm(fml=as.formula('Y ~ D1 | D2'), data = data, family = "poisson").

While in the latter version, fixest recognises that D2 predicts the outcome perfectly (and therefore discards the variable and related observations), the former method gives an, I think, misleading large negative estimate for D2. (The more negative the estimate here, the larger the likelihood function. This I think explains the large negative value here.)

I want to ask as if this an expected response? Is there perhaps an option to run checks for such separations?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant