1---2name: rct-core-design3description: Design randomized controlled trials for causal inference. Use when user mentions: randomized evaluation, RCT, field experiment, randomized experiment, treatment assignment, causal impact, experimental design, control group, intervention evaluation.4---56<skill_content>78<overview>9Randomized Controlled Trials (RCTs) are the gold standard for causal inference when randomization is feasible. Random assignment eliminates selection bias and balances observed and unobserved confounders in expectation, enabling clean identification of treatment effects. Strong RCT design requires careful attention to power, ethics, implementation fidelity, and threats to validity.1011RCTs answer "does X cause Y?" with minimal assumptions.12</overview>1314<mandatory_requirements>1516<requirement priority="critical">17 <name>Pre-Registration and Pre-Analysis Plan</name>18 <description>Register trial and file pre-analysis plan BEFORE data collection or analysis begins</description>19 <rationale>Pre-registration prevents p-hacking, specification searching, and publication bias. Credibility revolution in social science demands transparency (Christensen & Miguel 2018)</rationale>20 <consequence>Results perceived as data-mined, journals may reject, inability to make credible causal claims</consequence>21</requirement>2223<requirement priority="critical">24 <name>Adequate Statistical Power</name>25 <description>Conduct power analysis to ensure sufficient sample size for detecting meaningful effects</description>26 <rationale>Underpowered studies waste resources and risk null findings being misinterpreted as "no effect exists" (Button et al. 2013)</rationale>27 <consequence>Failure to detect true effects (Type II error), wasted intervention resources, misleading conclusions</consequence>28</requirement>2930<requirement priority="critical">31 <name>IRB Approval Before Enrollment</name>32 <description>Obtain Institutional Review Board approval before recruiting any participants</description>33 <rationale>Ethical research requires informed consent, risk minimization, and protection of human subjects (Belmont Report 1979)</rationale>34 <consequence>Research misconduct, legal liability, inability to publish, harm to participants</consequence>35</requirement>3637<requirement priority="high">38 <name>Clear Theory of Change</name>39 <description>Document logical pathway from intervention inputs to expected outcomes before implementation</description>40 <rationale>Theory of change guides measurement, timing decisions, and outcome selection. Makes assumptions testable</rationale>41 <consequence>Measuring wrong outcomes at wrong times, inability to interpret null results, missing mechanisms</consequence>42</requirement>4344<requirement priority="high">45 <name>Randomization at Appropriate Level</name>46 <description>Choose randomization unit (individual, cluster, geographic) to minimize spillovers while maintaining power</description>47 <rationale>Wrong randomization level causes contamination (spillovers violate SUTVA) or severe power loss from clustering</rationale>48 <consequence>Biased estimates from spillovers OR inability to detect effects due to power loss</consequence>49</requirement>5051</mandatory_requirements>5253<assumptions>5455<assumption name="SUTVA (No Spillovers)">56 <description>Treatment of one unit doesn't affect outcomes of other units</description>57 <how_to_check>Consider geographic proximity, social networks, market equilibrium effects</how_to_check>58 <if_violated>Use cluster randomization, measure spillovers explicitly, or accept partial equilibrium estimates</if_violated>59</assumption>6061<assumption name="Compliance">62 <description>Units assigned to treatment actually receive it (or model non-compliance)</description>63 <how_to_check>Monitor take-up rates during implementation, plan for imperfect compliance</how_to_check>64 <if_violated>Report ITT (policy-relevant) and use IV for LATE (efficacy for compliers)</if_violated>65</assumption>6667<assumption name="Stable Treatment">68 <description>Treatment delivered consistently across units and time</description>69 <how_to_check>Implementation fidelity checks, standardized protocols, training</how_to_check>70 <if_violated>Document variation, test for heterogeneous effects, consider implementation design</if_violated>71</assumption>7273<assumption name="No Attrition Bias">74 <description>Loss to follow-up is unrelated to treatment or would-be outcomes</description>75 <how_to_check>Track attrition rates by treatment arm, test for differential attrition</how_to_check>76 <if_violated>Use Lee bounds, inverse probability weighting, or report bounds on treatment effects</if_violated>77</assumption>7879</assumptions>8081<thinking_process>82When designing an RCT:831. Articulate research question and theory of change842. Identify outcomes and measurement strategy (primary vs. secondary)853. Conduct power analysis for required sample size864. Choose randomization level (individual vs. cluster) based on spillovers875. Design ethical treatment assignment (phase-in, lottery, encouragement)886. Prepare IRB protocol and obtain approval897. Register trial and file pre-analysis plan908. Implement with fidelity monitoring919. Plan for compliance, attrition, and threats to validity92</thinking_process>9394<implementation_pattern>9596<code_template>97```python98@app.cell99def power_analysis_rct():100 # Calculate required sample size for RCT design101 # Based on Duflo et al. (2007) power calculation framework102103 import numpy as np104 from scipy.stats import norm105106 # Parameters107 alpha = 0.05 # Significance level108 power = 0.80 # Statistical power109 mde = 0.25 # Minimum detectable effect (SD units)110 p = 0.50 # Proportion assigned to treatment111112 # Calculate critical values113 z_alpha = norm.ppf(1 - alpha/2) # Two-tailed test114 z_power = norm.ppf(power)115116 # Basic sample size117 n_base = ((z_alpha + z_power)**2) / (p * (1-p) * mde**2)118119 # Adjust for clustering if applicable120 icc = 0.05 # Intra-cluster correlation121 cluster_size = 30 # Average cluster size122 design_effect = 1 + (cluster_size - 1) * icc123 n_clusters = n_base * design_effect / cluster_size124125 # Adjust for attrition126 attrition_rate = 0.20127 n_final = n_base * design_effect / (1 - attrition_rate)128129 print(f"POWER ANALYSIS FOR RCT")130 print(f"Parameters: α={alpha}, power={power}, MDE={mde} SD")131 print(f"\nBase sample size: {int(np.ceil(n_base))}")132 print(f"Design effect: {design_effect:.2f}")133 print(f"Clusters needed: {int(np.ceil(n_clusters))}")134 print(f"Final N (with attrition): {int(np.ceil(n_final))}")135136 return int(np.ceil(n_final)),137```138</code_template>139140</implementation_pattern>141142<examples>143144<example context="ethical_design" difficulty="intermediate">145<description>Design RCT when direct denial of treatment raises ethical concerns</description>146<code>147```python148@app.cell149def ethical_rct_design():150 # Use phase-in design when denying treatment is ethically problematic151 # All units eventually receive treatment, but timing is randomized152153 import pandas as pd154 import numpy as np155156 # Context: Limited program slots, everyone gets treatment eventually157 # Solution: Randomize TIMING rather than ACCESS158159 n_units = 300160 n_cohorts = 3 # Roll out in 3 waves161162 # Assign units to cohorts randomly163 cohorts = np.random.choice(range(n_cohorts), size=n_units)164165 # Cohort 1: Immediate (Year 1)166 # Cohort 2: Delayed (Year 2)167 # Cohort 3: Delayed (Year 3)168169 df = pd.DataFrame({170 'unit_id': range(n_units),171 'cohort': cohorts,172 'year_treated': cohorts + 1 # Everyone gets treatment173 })174175 print("PHASE-IN / STEPPED WEDGE DESIGN")176 print("=" * 50)177 print(df.groupby('cohort').size())178179 print("\nEthical advantages:")180 print("- No one permanently denied treatment")181 print("- Addresses capacity constraints")182 print("- Still enables causal inference")183184 print("\nAnalysis approach:")185 print("- Compare early vs. late cohorts")186 print("- Use DID or event study framework")187 print("- Longer follow-up for early cohorts")188189 return df,190```191</code>192<lesson>193When direct denial is unethical: (1) Phase-in/stepped wedge (randomize timing), (2) Encouragement design (randomize encouragement, not access), (3) Lottery (when slots limited), (4) Oversubscription (randomize among eligible). Never deny established entitlements.194</lesson>195</example>196197</examples>198199<common_mistakes>200201<mistake severity="critical">202 <what>Not conducting power analysis before starting</what>203 <consequence>Underpowered study wastes resources, fails to detect real effects, misleads policy</consequence>204 <prevention>Always run power calculations with realistic effect sizes and account for clustering/attrition</prevention>205</mistake>206207<mistake severity="critical">208 <what>Starting data collection before IRB approval and registration</what>209 <consequence>Research misconduct, inability to publish, ethical violations</consequence>210 <prevention>IRB approval and trial registration are prerequisites, not afterthoughts</prevention>211</mistake>212213<mistake severity="high">214 <what>Individual randomization when spillovers likely</what>215 <consequence>SUTVA violation, biased estimates, contaminated control group</consequence>216 <prevention>Use cluster randomization or buffer zones when spillovers expected</prevention>217</mistake>218219<mistake severity="high">220 <what>Measuring outcomes before treatment fully delivered</what>221 <consequence>Premature measurement finds null effects when treatment hasn't had time to work</consequence>222 <prevention>Theory of change specifies timing - measure outcomes after sufficient exposure period</prevention>223</mistake>224225<mistake severity="medium">226 <what>Not planning for non-compliance</what>227 <consequence>Surprised by low take-up, insufficient power for actual treatment received</consequence>228 <prevention>Pilot to estimate take-up, power for ITT given expected compliance, design encouragement</prevention>229</mistake>230231</common_mistakes>232233<interpretation_guide>234235<design_checklist>236Before launching RCT:237- [ ] Research question clearly specified238- [ ] Theory of change documented239- [ ] Power analysis conducted (accounts for clustering, attrition)240- [ ] Outcomes and measurement plan specified241- [ ] Randomization method chosen (individual vs. cluster)242- [ ] Ethical design confirmed (no unjustified denial)243- [ ] IRB protocol submitted and approved244- [ ] Trial registered (AEA RCT Registry or equivalent)245- [ ] Pre-analysis plan filed246- [ ] Implementation fidelity plan created247- [ ] Compliance monitoring plan ready248- [ ] Attrition tracking procedures established249</design_checklist>250251<when_not_to_use_rct>252Avoid RCTs when:253- Randomization is unethical (denying life-saving treatment)254- Spillovers are unavoidable and large (market equilibrium effects)255- Sample size insufficient for adequate power256- Treatment is national-level policy (no counterfactual)257- Cost vastly exceeds value of information gained258- Results won't inform decisions (no policy window)259</when_not_to_use_rct>260261</interpretation_guide>262263<references>264<paper>Duflo, E., Glennerster, R., & Kremer, M. (2007). Using randomization in development economics research: A toolkit. Handbook of Development Economics, 4, 3895-3962.</paper>265<paper>Glennerster, R., & Takavarasha, K. (2013). Running Randomized Evaluations: A Practical Guide. Princeton University Press.</paper>266<paper>Christensen, G., & Miguel, E. (2018). Transparency, reproducibility, and the credibility of economics research. Journal of Economic Literature, 56(3), 920-980.</paper>267<paper>Button, K.S., et al. (2013). Power failure: why small sample size undermines the reliability of neuroscience. Nature Reviews Neuroscience, 14(5), 365-376.</paper>268<resource>J-PAL Research Resources: https://www.povertyactionlab.org/research-resources</resource>269</references>270271</skill_content>