Skip to content
StatsOtter A workspace for causal thinking
Method library WORKFLOW / 073
Research workflow/2 steps

Design & analyze randomized experiments (experiment)

01
The method workspace

Follow the analysis.

Select a node to explore the method

Method mapInput → 2 steps → output
START WITHInput data
ARRIVE ATResults
Read step 01
Inside the methodReasoning, equations & implementation
Step 1 of 2
01
Data prep

Randomize the treatment

Data preparation — shapes the raw inputs into what the estimator expects.

What happens here

Draw a complete randomization (here a 50/50 split over 100 units) with known assignment probabilities.

Reads fromNot specified Feeds into#2
Key code
# Install:  install.packages("experiment")
library(experiment)
set.seed(1)
z <- randomize(N = 100, ratio = c(0.5, 0.5))

Reference / docs ↗

Discussion on this step (0)
StatsOtterDiscussion starter · Editorial note

Before using this step, make its assumptions and its output explicit. A useful peer note explains what you would check, what could go wrong, or what would change your interpretation.

Questions to explore
  1. Which assumption matters most here, and what evidence could challenge it?
  2. What would you check before passing this output to the next step?

Peer discussion

  • Bring your experience, a question, or a different perspective.
02
Data contract

Inputs & data

Experimental units with a treatment indicator and outcome (plus optional cluster/block IDs and covariates).

Show data format & exampleHide example
unit cluster Z Y
1 A 1 4.2
2 A 1 5.1
3 B 0 3.4
4 B 0 2.9
03
Read the evidence

Results & interpretation

1 figure Workflow discussion 0
01FigureCluster-randomized ATE estimate with its design-based 95% confidence interval.

Result figure rendered by StatsOtter from the package's documented example — unofficial community showcase; all credit to the original authors.

The estimate

\hat\tau=\frac{1}{N}\sum_{j}\frac{n_j}{\bar n}\big(\bar Y_{j}^{T}-\bar Y_{j}^{C}\big)\quad(\text{cluster ATE})

Context & interpretation

⚠️ Unofficial community showcase of experiment (docs). Not affiliated with the authors — all credit to Kosuke Imai & Zhichao Jiang; this summarizes public documentation.

What it does. experiment packages Imai's tools for the full life-cycle of a randomized study: drawing the randomization, and then estimating the average treatment effect with design-based standard errors that respect how units were assigned.

How it works. randomize() produces complete / blocked / cluster assignments with known probabilities. For analysis, ATEcluster() estimates the ATE under cluster randomization using the Imai–King–Nall design-based variance, and companion functions handle noncompliance. Inference comes from the assignment mechanism, not an outcome model.

Assumptions. Known randomization, SUTVA; the cluster estimator assumes clusters were the unit of assignment.

What you get — A randomized assignment vector and a design-based ATE estimate with a standard error and confidence interval.

Example output

Estimated Average Treatment Effect (ATE):
   est       se      ci.lower   ci.upper
  0.142    0.061     0.022      0.262

Number of clusters:        50
Number of observations:   500

Links: package · paper

Peer notes

Discuss the workflow (0)

  • No comments yet — start the conversation.
IN THE MARGINS

Peer discussion