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

Placebo tests and extended plotting functionality #88

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

n-delaney
Copy link

The proposed changes:

  • Extend the functionality of the augsynth package by including the options for permuted placebo tests (raw and RMPSE-adjusted)
  • Move inference out of summary.augsynth() and into the augsynth() function by default
  • Extend plotting options, including placebo permutation plots and gap plots showing the divergence between the treated units and synthetic control over time

All of the changes to the augsynth package itself take place in augsynth.R and a new file, permutation.R.

The tobacco_replication directory contains a vignette demonstrating the new functionality and replicating the results of Abadie et al. (2010).

Rmd file and data for replication of Abadie et al. (2010)
-updates functions in augsynth.R
-adds permutation.R (also contains some plotting functions)
-updates package documentation
Updates the github directory in tobacco replication vignette
Replaces convention of inf = F with inf_type = 'none'.
- Separates out inference from estimation. Sets augsynth(inf = "none") by default, which should be backwards compatible.
- Adds plot_type as an argument for plot.augsynth (allows user to specify the "name" of the desired outputted plot).
- Adds the option to generate a donor table (synthetic control weights and RMSPEs for any inference type)
- Ensures that all existing tests execute successfully.
Updates to abadie et al 2010 replication notebook
Adds warnings to multi-outcome and multisynth models if a user attempts to pass in `inf_type` at the time of model fitting.
@n-delaney n-delaney closed this Feb 14, 2024
@n-delaney n-delaney reopened this Feb 14, 2024
Copy link
Owner

@ebenmichael ebenmichael left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall I think there needs to be a structural change to keep inference calculations in summary.augsynth. The new add_inference function seems to be necessary only to add inference output to the augsynth function, but that should be restricted to the summary.augsynth function. I've called out parts of the code where this can be changed, but mostly it means that all of the new plotting work should happen in the plot.summary.augsynth function, and then the augsynth object never needs any inference added to it.

R/augsynth.R Outdated Show resolved Hide resolved
pull(quo_name(unit)) %>% unique()
augsynth$time_var <- quo_name(time)
augsynth$unit_var <- quo_name(unit)
augsynth$raw_data <- data
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me why the output object needs to carry the raw data around. Can this be removed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the raw_data attribute for the update_augsynth() function (which drops items based on RMSPE, etc.).

R/augsynth.R Show resolved Hide resolved
R/augsynth.R Outdated Show resolved Hide resolved
R/augsynth.R Outdated Show resolved Hide resolved
R/permutation.R Outdated Show resolved Hide resolved
R/permutation.R Outdated Show resolved Hide resolved
R/permutation.R Show resolved Hide resolved
R/permutation.R Outdated Show resolved Hide resolved



test_that( "MDES_table corresponds to default treatment table", {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this test be broken up into subtests, since it looks like there are a few distinct things.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good test would be that the placebo gaps agree with manually changing the treatment variable in the data and re-running augsynth.

lmiratrix and others added 14 commits August 28, 2024 18:06
- adds a test for update_augsynth() ensuring that non-binding update criteria (ex. RMPSE multiple of infinity) return the same donor weights as the original model.
- removes superfluous datasets froom the tobacco_replication.Rmd file
- updates a test in test-donor_control.R to resolve an error from a variable that is called but not defined (or used as part of the test, as far as I can tell)
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

Successfully merging this pull request may close these issues.

3 participants