childpen childpen logo

This package accompanies the paper Leventer, Dor. Identification of Child Penalties. arXiv:2602.07486.

childpen estimates the paper’s 2x2 comparisons of parents by age at first birth (a treatment group against the closest not-yet-treated group, by gender), with standard errors clustered by person:

simulate_data() generates a panel with the paper’s patterns and known true values.

Installation

Install the released version from CRAN:

install.packages("childpen")

Or the development version from GitHub:

# install.packages("remotes")
# remotes::install_github("dorleventer/childpen")
install.packages("childpen", repos = c('https://dorleventer.r-universe.dev', 'https://cloud.r-project.org'))

Example

The effect of parenthood on the gender earnings ratio, by treatment group and event time (the NTD estimates of the paper’s Figure 6b), on simulated data:

library(childpen)
library(ggplot2)
sim <- simulate_data(n_individuals = 20000, treatment_groups = 24:32)
res <- multiple_treatment_group_analysis(sim, treatment_groups = 25:28, periods_post = 3,
                                         periods_pre = NULL, verbose = FALSE)
est <- subset(res, method == "NTD" & estimand == "rho_effect")
ggplot(est, aes(event_time, est, ymin = ci_l, ymax = ci_h)) +
  geom_hline(yintercept = 0, linetype = "dashed", colour = "grey50") +
  geom_ribbon(alpha = 0.2) + geom_line() + geom_point() +
  facet_wrap(~ d, nrow = 1, labeller = label_both) +
  labs(x = "Event time", y = "Effect on gender earnings ratio (95% CI)")

Articles

  1. Notation and output: the 2x2, the estimands, and what each output row is.
  2. Estimation: the grid of comparisons, every estimator and its influence function.
  3. Aggregation: estimands across treatment groups, weights and standard errors.
  4. Replicating the paper: the paper’s figures, one by one, on simulated data.