| sim_count_panel | R Documentation |
Generates simulated panel data with a count outcome (Poisson-distributed) and staggered treatment adoption. Treatment effect is multiplicative (rate ratio) on the count scale.
sim_count_panel(
n = 500L,
nperiods = 6L,
prop_treated = 0.5,
n_cohorts = 3L,
true_rr = 1.5,
base_rate = 5,
overdispersion = FALSE,
seed = NULL
)
n |
Integer. Number of units. Default 500. |
nperiods |
Integer. Number of time periods. Default 6. |
prop_treated |
Numeric. Proportion of units ever treated. Default 0.5. |
n_cohorts |
Integer. Number of treatment cohorts. Default 3. |
true_rr |
Numeric or vector. True rate ratio for each cohort. Default 1.5 (50 percent increase in count). |
base_rate |
Numeric. Baseline Poisson rate. Default 5. |
overdispersion |
Logical. Add overdispersion (negative binomial). Default FALSE. |
seed |
Integer. Random seed. |
Long-format data frame with columns: id, period, y, g, D, x1.
dat <- sim_count_panel(n = 400, nperiods = 6, true_rr = 1.8)
summary(dat$y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.