Randomized Experiments

Principles of experimental design

  • The Confounding Problem
  • Randomization solves the Confounding Problem (Identification)
  • Blinding
  • Control and treatment protocols
  • Random assignment
  • Covariates
  • Covariate Balance
  • Standardized Mean Difference (SMD)
  • Love plot

In the previous episode: Can we use difference in means?

Last time we spoke, I left you with a cliffhanger. We wanted to estimate the Average Treatment Effect (\(\mbox{ATE} \equiv E(Y_t - Y_c) \mbox{ or } \mu_{Y_t - Y_c}\)). But we can’t observe both counterfactuals for each unit, so instead we thought of using the difference in means between treatment sample and control sample (\(\bar{Y}_{D=1}-\bar{Y}_{D=0}\)).

But does it work? Always? Sometimes? Never?

The problem of Confounding

In the slides of last lecture we saw that the true ATE for class score under prof. Biegschott vs prof. Nobbo-Dee (if we had access to both counterfactuals for the entire, tiny, population) was

Name Score with prof. B (\(Y_t\)) Score with prof. N (\(Y_c\))
Maria 73% 77%
Fan 60% 64%
Durga 80% 95%
Muhammad 69% 70%

\[ \begin{aligned} \mbox{ATE} &= \frac1{4} \left((73\%-77\%) + (60\%-64\%)+ (80\%-95\%) + (69\%-70\%)\right) =\\ & =\frac1{4} \left(-4\% -4\% -15\% -1\%\right) = -6\% \end{aligned} \]

But we instead observed the population:

Name Professor (\(D\)) Score (\(Y\))
Maria Biegschott (1) 73%
Fan Nobbo-Dee (0) 64%
Durga Biegschott (1) 80%
Muhammad Nobbo-Dee (0) 70%

and tried to use

\[ \begin{aligned} E(Y|D=1) - E(Y|D=0) &= \frac1{2} \left(73\% + 80\%\right) - \frac1{2} \left(64\% + 70\%\right) = \\ &=76.5\% - 67\% =+9.5\% \end{aligned} \]

Sadly: \[\mbox{ATE} = -6\% \neq 9.5\% = E(Y|D=1) - E(Y|D=0)\]

We would have been fooled! Because people with higher baseline scores anyway decided to enroll more with one professor vs. the other. They self selected into the treatment group. This is called Self-Selection Bias and is an example of Confounding.

def: The Confounding Problem

Given a binary treatment, \(D=0,1\), if the potential outcomes \(Y_c, Y_t\) are associated with the treatment variable, (e.g. people with higher \(Y_t\) tend to choose to take the treatment), then the difference in means estimator (\(\bar{Y}_{D=1}-\bar{Y}_{D=0}\)) is a biased estimator of the ATE.

Another way to express that is

\[\mbox{ATE} \mbox{ or } E(Y_t-Y_c) \neq E(Y|D=1) - E(Y|D=0)\]

The population \(\mbox{ATE}\) is not the same as the difference between the population means for treated and controls. When they are equal, we say the \(\mbox{ATE}\) is identified.

Before you move on, please click here: three very confusing and very different concepts

1. Population average treatment potential outcome \[E(Y_t) \mbox{ or } \mu_{Y_t}\]

This is the (unknowable) population expectation of the (unknowable) completely hypothetical potential outcome if the subjects of the population had taken the treatment \(D=1\).

It’s a population parameter. It’s twice unknowable! Unknowable because we never know the entire population and unknowable because we can never know both counterfactuals (both control and treatment for everyone).

This is the Holy Grail!

2. Population average outcome for the treated

\[ E(Y|D=1) \mbox{ or } \mu_{Y,D=1} \]

This is the (unknowable) population expectation of the observable actual outcome of the population subjects who took the treatment \(D=1\).

It’s a population parameter. It’s once unknowable! Unknowable because we never know the entire population.

3. Sample average outcome for the treated

\[ \bar{Y}_{D=1} \mbox{ or } \frac1{n_t} \sum_{D_i =1} Y_i \]

This is the observable sample mean of the observable actual outcome of the \(n_t\) sample subjects who took the treatment \(D=1\).

It’s a random variable, a sample statistic. It’s perfectly knowable!

Relations among them

\(\bar{Y}_{D=1}\) is a good estimator for \(E(Y|D=1)\). But unfortunately, if \(E(Y|D=1) \neq E(Y_t)\), then \(\bar{Y}_{D=1}\) is not a good estimator for \(E(Y_t)\).

All of the above can be repeated for the control, \(D=0\), of course.

If you’re sitting there crying because statistics has very messy notation, I don’t know what to tell you. Notation is your friend. It helps you when you’re confused. It anchors you to a safe mathematical machine. It warns you about your confusions. It’s a good friend with a complicated personality. You can do it!

This is what people mean, when they say, sloppily, “correlation isn’t causation”.

So, what estimator to use?

There are many ways to try to get around this huge problem.

If the problem is self-selection. What would you suggest doing?

Well, what if instead of letting people decide for themselves whether to get the control (\(D=0\)) or the treatment (\(D=1\)), we make the decision ourseleves, the benign dictator-scientists, in a completely unbiased way?

And what’s more unbiased than flipping a coin, or rolling a die?

Randomized Experiments, where subjects are randomly assigned to treatment or control conditions by the researcher, are the most scientifically safe, demonstrable, simple (but also expensive, and sometimes unethical) way to eliminate this bias!

fact: Randomized Experiments are identified!

For a randomized experiment, the following equality is true!

\[\mbox{ATE} \mbox{ or } E(Y_t-Y_c) = E(Y|D=1) - E(Y|D=0)\]

As a consequence, we can use

\(\widehat{\mbox{ATE}} = \bar{Y}_{D=1}-\bar{Y}_{D=0}\) to estimate the \(\mbox{ATE}\). It’ll be unbiased!

Let’s see how we build and run a good Randomized Experiment.

Principles of Experimental Design

An experiment is generally characterized as being a setting where the researcher actively assigns subjects or units to one particular condition or another. The most potent design of an experiment to determine whether one variable, the treatment, affects the outcome at the group level is the aptly named Randomized Controlled Trial (RCT).

As a running example, consider an immediately relevant question: would reading these notes as a PDF lead to a deeper understanding and a correspondingly better score on the final exam than reading them as a webpage? Let’s run through each term one-by-one to think through how to design an RCT and effectively answers this question.

Control and Treatment Protocols

When designing an RCT, an essential decision is the nature of your control group. Our research question is: will reading these notes as a webpage result in a deeper understanding? Deeper . . . than what? Deeper than if you didn’t read the notes at all? Deeper than if you read them aloud?

If we’re most interested in the difference between reading the notes as a webpage and reading them as a pdf, we could declare those who read the website part of the control group and those who read the pdf as part of the treatment group. Small changes to the control group can make an important difference in the precise question that you’ll be answering.

If we pick a control and treatment that don’t translate to real-life applications, our study will produce useless conclusions.

We can visualize the distinction between the two groups in a small example with three people in the control group (website) and three people in the treatment group (pdf).

name group understanding
Evelyn pdf deep
Grace pdf shallow
Juan pdf deep
Alex website deep
Monica website shallow
Sriya website shallow

The process of computing a difference in proportions and conducting a hypothesis test for this dataset is no different than in the examples from the generalization notes. What makes this study special is the process that generated this data. Because this was a randomized controlled experiment, the difference in proportions provides a good estimate of the average treatment effect, and if it differs significantly from zero we have compelling evidence that reader format has a causal impact on understanding. We now describe some aspects of experimental design that help establish this stronger interpretation.

Random Assignment

def: Random assignment

The process where the researcher assigns each unit to the treatment or control groups by drawing a random number, 0 or 1, with a fixed probability \(p\) of getting 1.

As I said above, the probability \(p\) doesn’t have to be 50% but it often is the case. (An exception was the Mythbusters yawning experiment, which used \(p\approx \frac{2}{3}\)).

Because we are conducting an experiment, we are intervening in the process and directly assigning subjects to either the treatment (pdf readers) and control (website readers). There are many ways we could do this. The morning sections could all be assigned the pdf and the afternoon sections the website. Or the instructors could choose to exclusively assign either the pdf or the website version of the notes to their individual sections.

The problem with both of these approaches is that our two groups might differ on more characteristics than just their reading format. The morning sections perhaps have students who are early risers and more diligent students (please forgive our stereotypizing). Or perhaps the instructors who choose the website are more tech-savvy and more effective at teaching computing. In both cases, we justify a skeptical observer to question whether it was truly the medium of the notes that led to a difference in course grades or if it was something else.

The mechanism of random assignment is brilliant because it can obliterate every such suspicion. If we assign each student to read the pdf or the website totally at random, every other possible characteristic between these groups should, on average, be balanced. If students are assigned at random, we’d expect an equal number of early-risers to be in both the pdf and the website group. We’d also expect the students with the more effective instructors to be evenly represented in both groups. And so on and so forth, for every possible other characteristic that might muddy the waters of our causal claim.

Sampling variance

Well yeah. This is still a generalization problem. If you were to repeat the experiment again, you wouldn’t observe the same exact value of the sample statistics, right?

What if, purely due to bad luck, we happen to randomly assign all of the early-risers to the pdf group and all of the late-risers to the website group? That would indeed bring us back to the problem of there being many ways in which our treatment group is different from our control group.

The random assignment mechanism will balance out all possible confounding factors on average, but for a given experiment that is not guaranteed. However, it becomes much more likely if we have a large sample size. If you just have four students total in the class, two of whom are early risers, it’s quite easy for both of them to end up in the pdf group if they were assigned at random. If instead you have 800 students, 400 of whom are early risers, it’s very very unlikely that all 400 will have made their way into the pdf group.

But why are we pointing this out? You know that very well already.

Blinding

Randomized controlled trials have long been considered the gold standard for establishing a group-level causal claim, but care must be taken to ensure that your result means what you think it means. Here we reconsider a study where a new drug was used to treat heart attack patients. In particular, researchers wanted to know if the drug reduced deaths in patients.

These researchers designed a randomized control trial because they wanted to draw causal conclusions about the drug’s effect. Study volunteers were randomly assigned to one of two study groups. One group, the treatment group, received the drug. The control group did not receive any drug treatment.

Put yourself in the place of a person in the study. If you are in the treatment group, you are given a fancy new drug that you anticipate will help you. If you are in the control group, you are not treated at all but instead sit by idly, knowing you are missing out on potentially life-saving treatment. These perspectives suggest there are actually two effects in this study: the one of interest is the effectiveness of the drug, and the second is the emotional effect of (not) taking the drug, which is difficult to quantify. In order to control for the emotional effect of taking a drug, the researchers decide to hide from patients which group they are in.

When researchers keep the patients uninformed about the treatments they will receive, the study is said to be single-blind. But there is one problem: if a patient does not receive a treatment, they will know they’re in the control group. A solution to this problem is to give a fake treatment to patients in the control group. This is called a placebo, and an effective placebo is the key to making a study truly blind. A classic example of a placebo is a sugar pill that is made to look like the actual treatment pill. However, offering such a fake treatment may not be ethical in certain experiments. For example, in medical experiments, typically the control group must get the current standard of care. Oftentimes, a placebo results in a slight but real improvement in patients. This effect has been dubbed the placebo effect.

The patients are not the only ones who should be blinded: doctors and researchers can also unintentionally affect the outcome. When a doctor knows a patient has been given the real treatment, they might inadvertently give that patient more attention or care than a patient that they know is on the placebo. To guard against this, which again has been found to have a measurable effect in some instances, most modern studies employ a double-blind setup where doctors or researchers who interact with patients are, just like the patients, unaware of who is or is not receiving the treatment.

def: (double) Blinding

The practice of keeping (both) the subjects and the researcher uninformed about which subjects in the study have been assigned to treatment and control.

Blinding ensures that the experimental conditions are representative of real-life applications, so the conclusions are applicable in real life.

Putting it all together: how to conduct a Randomized Experiment

def: Randomized Experiment Flow

  • Formulate a causal question and identify outcome \(Y\) and treatment \(D\) variables
  • Select a representative sample from the population.
  • Make sure that treatment and control conditions are representative of real-world situations.
  • Randomization. Assign each unit to either control or treatment groups randomly with some probability \(p\). (If \(p=0.5\) then control and treatment groups will be of similar size).
  • Run the experiment and collect the data.
  • Perform a generalization analysis. For example
    • estimate \(\mbox{ATE}\) with \(\widehat{\mbox{ATE}} = \bar{Y}_{D=1}-\bar{Y}_{D=0}\) and build a Confidence Interval, or
    • try and disprove a null hypothesis like \(H_0 : \mbox{ATE} =0\) by using test statistic \(T=\bar{Y}_{D=1}-\bar{Y}_{D=0}\)

Using additional variables in experimental design

Covariates

Let’s return to our hypothetical pdf vs. website experiment and imagine that in addition to our subject’s names and understanding level we were able to collect some additional information about each of them.

name group understanding major GPA native_speaker
Evelyn pdf deep Statistics 3.81 Yes
Grace pdf shallow Economics 3.63 No
Juan pdf deep Economics 3.20 Yes
Alex website deep Statistics 2.85 No
Monica website shallow Economics 3.19 Yes
Sriya website shallow Statistics 3.80 Yes

Who cares, right?

Well. In principle we don’t, because randomization is enough to guarantee we can estimate the \(\mbox{ATE}\). However, 1. in the future, when we drop the assumption of randomization, we’ll definitely need to collect more variables in order to estimate the \(\mbox{ATE}\). 2. even for randomized experiment, we can leverage other variables to make sure our randomization was done well!

If a variable was impacted by the treatment then in practice it would just be another outcome variable that we might or might not be interested in. This is why we instead need to focus on variables that could not have been impacted by treatment.

def: (Valid) Covariate

A measured variable that couldn’t have been impacted by the assignment of the subject to treatment or control.

One way to ensure something couldn’t have been impacted by something else is to think like a Physicist and notice that covariates cannot be affected by the treatment if they were measured before the treatment group was even assigned! Variables measured after treatment, including the outcome variable, may be affected by the treatment!

In our example, it’s reasonable to imagine that major, GPA, and native speaker status could all have been determined prior to the assignment, so they are valid covariates.

Covariate balance

Note that many of these covariates seem likely to be associated with the outcome. For example, students with a higher GPA may be more committed to doing class readings and be more likely to gain a deep understanding regardless of format. If one group had more high-GPA students, that group might look like it had benefited from its reading format even if there were no difference between the formats for any single student. This motivates us to look for a quality called balance.

def: Covariate Balance

Given a binary treatment \(D\) and some covariate \(X\), the covariate is balanced between treatment and control if the (population) distributions of \(X\) in control and treatment are the same. (Using PDFs)

\[f_{X|D=1} = f_{X|D=0}\]

An easier to handle consequence of that is that the expectations are the same:

\[E(X|D=1)= E(X|D=0)\]

The latter statement doesn’t necessarily imply the former, but it’s often close enough…

On the other hand, if the distributions are different between the treatment group and the control group, we say that the covariate is imbalanced.

There is a close link between covariate balance and randomized treatment assignment. Because treatment is randomly assigned with equal probability for each individual in our study, there is no way it should be able to systematically move higher-GPA students into one of the two groups. The same is true of all our other covariates. Thus we expect randomization to balance our covariates in general.

To check the balance of our GPA variable, it can be helpful to calculate a measure of difference between groups for a single covariate \(X\).

def: Standardized Mean Difference (SMD)

With a binary treatment \(D\) and some covariate \(X\), define

\[ \mbox{SMD}(X) \equiv \frac{\bar{X}_{D=1} - \bar{X}_{D=0}}{\sqrt{\frac{1}{2}s_{X,D=1}^2 + \frac{1}{2}s_{X, D=0}^2}} \]

The numerator is just the difference in sample means (subtracting the control mean from the treated mean). To make the differences in means comparable across variables with very different scales, we divide by a “pooled” standard deviation estimate, which comes from averaging the sample variances of the covariate in the two groups and taking the square root. For GPA in our data frame above, the difference in means between groups is 3.28 \(-\) 3.55 \(=\) -0.27 and the pooled standard deviation is 0.41, so the SMD is -0.66.

What are the units of measurment of SMD?

It’s a ratio of something with the same units as \(X\) and something with also the same units as \(X\). So, it has no units.

A sanity check: covariate balance in an experiment

To get a quick look at balance across all our variables, we can create a Love plot:

The Love plot displays standardized mean differences (on a common scale on the x-axis) for all the covariates in our study, highlighting which covariates are most different between groups and in which direction.

Clearly in our experiment not all variables are perfectly balanced. This alone isn’t a red flag — after all, randomized experiments only balance covariates on average, and some small differences are expected — but it can be challenging to determine whether the differences are big enough to matter, especially in a study this small.

One way to address this problem is by using hypothesis tests. For each covariate, we can test the null hypothesis that this covariate is independent of treatment and produce a p-value. In practice this is just like the tests from the generalization unit, but it uses the covariate in the test statistic instead of the outcome. Here we conduct this test for GPA.

The p-value is 0.396. Clearly the difference in means we observed for GPA is not unexpected under random treatment assignment given our small sample size. Note that although our ultimate project here is investigating a causal claim, this particular step is an example of generalization: based on the particular set of treatment assignments we see in this dataset (the sample), we are making a claim about the broader process that generated the treatment assignments.

One of the most important reasons to check covariate balance is to catch problems with how the experiment was run. Suppose that we’d intended to sort a spreadsheet in a random order and assign the top half of the subjects to pdf, but that by accident we sorted on GPA instead of randomly. In this case our covariate balance test would likely have rejected the null hypothesis that treatment was randomly assigned, allowing us to catch the issue. For this reason it is often a good idea to check balance before actually running the experiment!

Summary

You may have heard the phrase “Correlation does not imply causation … unless it’s seen in data from a randomized control trial.”

In other words, we have seen that unfortunately we can’t estimate the \(\mbox{ATE}\) unless the data was collected in specific ways, because subjects with higher or lower values of their potential outcomes might prefer to end up in treatment or control, fooling us. (Confounding)

Randomized Experiments are the simplest way to solve this problem, and they work by creating carefully designed control and treatment conditions and then assigning subjects to groups, at random. Then we use estimation or hypothesis testing like we learned in the generalization unit to find the \(\mbox{ATE}\). We can use covariates, variables measured before the treatment, to check if they are balanced between the two groups, as a sanity check that the randomization was done correctly.