|
486 | 486 | " first_treat='first_treat', survey_design=sd_rep,\n", |
487 | 487 | ")\n", |
488 | 488 | "\n", |
489 | | - "# Compare TSL vs replicate SE\n", |
490 | | - "# (Use the same data with strata/PSU/FPC for TSL)\n", |
491 | | - "sd_tsl = SurveyDesign(weights='weight', strata='stratum', psu='psu', fpc='fpc')\n", |
492 | | - "cs_tsl = CallawaySantAnna(control_group='never_treated')\n", |
493 | | - "results_tsl = cs_tsl.fit(\n", |
494 | | - " df_rep, outcome='outcome', unit='unit', time='period',\n", |
495 | | - " first_treat='first_treat', survey_design=sd_tsl,\n", |
496 | | - ")\n", |
497 | | - "\n", |
498 | | - "print(f\"{'Method':20s} {'ATT':>10s} {'SE':>10s}\")\n", |
499 | | - "print(\"-\" * 42)\n", |
500 | | - "print(f\"{'TSL (strata/PSU/FPC)':20s} {results_tsl.overall_att:>10.4f} {results_tsl.overall_se:>10.4f}\")\n", |
501 | | - "print(f\"{'JK1 (replicate wts)':20s} {results_rep.overall_att:>10.4f} {results_rep.overall_se:>10.4f}\")\n", |
502 | | - "print(f\"\\nBoth methods correctly account for the survey design.\")\n", |
503 | | - "print(f\"In practice, use whichever your survey provides.\")" |
| 489 | + "print(f\"Overall ATT: {results_rep.overall_att:.4f} (SE: {results_rep.overall_se:.4f})\")\n", |
| 490 | + "print(f\"Survey d.f.: {results_rep.survey_metadata.df_survey}\")\n", |
| 491 | + "print(f\"Replicate method: {results_rep.survey_metadata.replicate_method}\")\n", |
| 492 | + "print(f\"Number of replicates: {results_rep.survey_metadata.n_replicates}\")\n", |
| 493 | + "print()\n", |
| 494 | + "print(\"Note: JK1 replicates are unstratified (global delete-one-PSU).\")\n", |
| 495 | + "print(\"If your survey uses stratified sampling, stratified replicates (JKn)\")\n", |
| 496 | + "print(\"provide design-consistent variance estimation. Use whichever method\")\n", |
| 497 | + "print(\"your survey documentation specifies.\")" |
504 | 498 | ] |
505 | 499 | }, |
506 | 500 | { |
|
697 | 691 | "| **CallawaySantAnna** | Full | Full | Full | Multiplier at PSU |\n", |
698 | 692 | "| **TripleDifference** | Full | Full | Full (analytical) | -- |\n", |
699 | 693 | "| **SunAbraham** | Full | Full | -- | Rao-Wu rescaled |\n", |
700 | | - "| **StackedDiD** | pweight only | pweight only | -- | -- |\n", |
| 694 | + "| **StackedDiD** | pweight only | Full (pweight only) | -- | -- |\n", |
701 | 695 | "| **ImputationDiD** | Full | Partial (no FPC) | -- | Multiplier at PSU |\n", |
702 | 696 | "| **TwoStageDiD** | Full | Partial (no FPC) | -- | Multiplier at PSU |\n", |
703 | 697 | "| **ContinuousDiD** | Full | Full | Full (analytical) | Multiplier at PSU |\n", |
|
707 | 701 | "| **BaconDecomposition** | Diagnostic | Diagnostic | -- | -- |\n", |
708 | 702 | "\n", |
709 | 703 | "**Legend:**\n", |
710 | | - "- **Full**: Weights + strata/PSU/FPC + Taylor Series Linearization variance\n", |
| 704 | + "- **Full**: Weights (all types) + strata/PSU/FPC + Taylor Series Linearization variance\n", |
| 705 | + "- **Full (pweight only)**: Full TSL support with strata/PSU/FPC, but only accepts `pweight` weight type (`fweight`/`aweight` rejected because Q-weight composition changes their semantics)\n", |
711 | 706 | "- **Partial (no FPC)**: Weights + strata (for df) + PSU (for clustering); FPC raises `NotImplementedError`\n", |
712 | | - "- **pweight only**: Sampling weights for point estimates; no strata/PSU/FPC\n", |
| 707 | + "- **pweight only**: Sampling weights for point estimates; no strata/PSU/FPC design elements\n", |
713 | 708 | "- **Diagnostic**: Weighted descriptive statistics only (no inference)\n", |
714 | 709 | "- **--**: Not supported\n", |
715 | 710 | "\n", |
|
0 commit comments