Claude/respond to request 011 c uf um nex zjf ft ayo gb s3k#3
Closed
Claude/respond to request 011 c uf um nex zjf ft ayo gb s3k#3
Conversation
The baseline row was missing the relative_time column, causing is_baseline to be NA instead of TRUE. This resulted in the baseline point being dropped from plots when plot_es() filters out rows with NA values. Added relative_time = as.integer(baseline) to the baseline_row tibble creation in the classic method section, ensuring that: - The baseline row has the correct relative_time value - The is_baseline flag is properly set to TRUE for the baseline row - plot_es() correctly displays the baseline point and doesn't connect non-adjacent points
Changed the classic event study specification to use proper interaction
terms (treat × relative_time) instead of treating the treatment variable
as time-varying. This resolves collinearity issues with fixed effects.
Key changes:
1. Calculate relative_time (k_vec) for all observations, not just treated ones
2. Add treatment group indicator (..treat) to model data
3. Use fixest::i() function to create proper interaction terms:
i(..f, ..treat, ref = baseline)
4. Update term name extraction to handle i() output format
5. Modify .compute_metadata() to use treatment indicator for counting
This ensures that:
- Event dummies are created as treat × 1{relative_time = k}
- The specification avoids collinearity with individual and time fixed effects
- Control group observations are properly included in the regression
- The model correctly implements two-way fixed effects event study design
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.