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

Predict residual outside e(sample) #278

Open
shwlin-econ opened this issue Sep 26, 2023 · 0 comments
Open

Predict residual outside e(sample) #278

shwlin-econ opened this issue Sep 26, 2023 · 0 comments

Comments

@shwlin-econ
Copy link

shwlin-econ commented Sep 26, 2023

Feature request

Is your feature request related to a problem? Please describe.

Is there any method to predict the residuals outside e(sample)?

Describe the solution you'd like

Hi Sergio,
I am estimating a regression model with individual FE and year FE. The regression is controlled for some polynomial age trends because age is an important factor in the outcomes. Since the treatment is perfectly collinear with age, I estimate the effect in two steps as follow:

reghdfe outcome age_controls if treated!=1, a(id year) cl(birth_cohort) resid
predict residual, res
reg residual treated, r

However, predict does not predict for those treated==1. I've tried to force it to predict residuals for the treated observations by adding if !e(sample) but in vain. Is there any method to make it predict residuals for the observations excluded? I read some previous discussions about this issue, but I think my case is a little bit different. In my case, each individual is not treated in some years, and each year some individuals are not treated. No new FEs need to be estimated.

Regards,
SW

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