three_period_subset: Three-Period Subset for Panel QTT

View source: R/panel_qtt.R

three_period_subsetR Documentation

Three-Period Subset for Panel QTT

Description

Custom subset_fun for ptetools::pte that pulls three time periods for each (g,t) cell: pre2, pre1 = g - anticipation - 1, and post = tp. How pre2 is chosen depends on pre_copula:

"long" (default)

pre2 = 2*(g - anticipation) - tp - 2, so the copula-transfer window matches the event horizon e = tp - (g - anticipation). Cells where this pre2 does not exist in the data return empty data and panel_qtt_gt returns NA.

"short"

pre2 = g - anticipation - 2 (fixed at treatment onset regardless of e).

For pre-treatment placebo cells (tp < g - anticipation), the base always slides backwards regardless of pre_copula: pre2 = tp - 2, pre1 = tp - 1. panel_qtt() sets required_pre_periods = 2 so that the minimum tp in tlist is the third period, guaranteeing tp - 2 is always a valid period.

Usage

three_period_subset(
  data,
  g,
  tp,
  control_group = "notyettreated",
  anticipation = 0,
  pre_copula = "long",
  ...
)

Arguments

data

A data frame prepared by ptetools::setup_pte.

g

The current group (first treatment period).

tp

The current time period.

control_group

"notyettreated" (default) or "nevertreated".

anticipation

Number of periods of anticipation. Default 0.

pre_copula

"long" (default) or "short". See above.

...

Additional arguments; silently ignored.

Value

A list with elements gt_data, n1, disidx.


qte documentation built on July 23, 2026, 5:13 p.m.