<p>In terms of a textbook, The Handbook of Experimental Economics, John Kagel
and Alvin E. Roth, editors, Princeton University Press,
1995.</p>
<p>I'm not sure the customer-based approach is very feasible. Is the idea that many customers approach the ice cream stand each day, some buy, some don't buy, and your outcome is a binary variable for buying, with a regressor being the price on the day? It's not crazy, but I think in practice it wouldn't work. Customers will likely know the price on a day and only approach the stand if they are willing to buy. Thus, the outcome will almost always be 1.</p>
<p>This idea might be more feasible in an online setting in which the price shown on the website is randomized, and then some customers buy or not. Many online retailers do this to learn the demand curve they face.</p>
<p>In general, estimating demand curves is extremely hard. You can look up the Berry, Levinsohn, and Pakes (1995) method for the primary tool used by economists in non-experimental methods.</p>

CC BY-SA 4.0
2023-07-11T15:06:21.977Z
I agree with the idea of the online setting. This is a much cleaner approach (you won't have issues regarding SUTVA), and it will allow you to maximise power (it is usually cheaper).
ju_pi_car
CC BY-SA 4.0
2023-07-18T09:58:29.603Z
Thanks for the thoughts. However, I can't do the individual level randomisation in my setting.
afreelunch
CC BY-SA 4.0
2023-07-11T14:24:58.363Z
2023-07-11T14:24:58.363Z
Michael Gmeiner
<p>A way to find an answer to your question is to make identification assumptions clear. Here, you need the SUTVA to hold (and that might be problematic in your case):</p>
<p><strong>Consumers' decisions to buy an ice cream today are independent of the price of the ice cream in the past. In other words, you don't have spillover effects from one day to another.</strong></p>
<p>Then, if your treatment is perfectly randomised, the price on a given day <span class="math-container">$p_t$</span> should be independent of the weather on that day <span class="math-container">$w_t$</span> (or any other covariates you can think of). As such, when looking at the effect of price on the demand for ice cream (let's call it <span class="math-container">$D_t$</span>), you can simply run the following OLS:</p>
<p><span class="math-container">$$D_t = \alpha + \beta \cdot p_t + \epsilon_t$$</span></p>
<p>But for that, you will need perfect randomisation (i.e., price is independent of any covariates you might think of) and SUTVA to hold (i.e., only price in period <span class="math-container">$t$</span> affects decisions of period <span class="math-container">$t$</span>).</p>

CC BY-SA 4.0
2023-07-11T15:04:34.560Z
2023-07-11T15:04:34.560Z
ju_pi_car
<p>I have just realised that this is just a cluster randomised trial (CRT). Usually, clusters are geographical units that are treated or not (e.g. different villages); here, however, the clusters are time units (days).</p>
<p>As I expected, the standard analysis of a CRT yields results between those from the 'most conservative' and 'least conservative' approaches discussed in the question. To illustrate, here is an example dataset. In the example, there are 4 days, evenly divided between the low price (\$1) and high price (\$2). Assume that, on every day, 12 customers approach the stall (without knowing the price in advance).</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th>Day</th>
<th>Price</th>
<th>Sales</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>1</td>
<td>10</td>
</tr>
<tr>
<td>2</td>
<td>2</td>
<td>5</td>
</tr>
<tr>
<td>3</td>
<td>1</td>
<td>12</td>
</tr>
<tr>
<td>4</td>
<td>2</td>
<td>7</td>
</tr>
</tbody>
</table>
</div>
<p>On average, sales are 11 on low price days and 6 on high price days. How do we compare these numbers statistically?</p>
<ul>
<li>If we simply regress sales on price, which implicitly treats all units as independent, then we obtain a p-value of <strong>0.001</strong>. This is the least conservative approach and seems invalid: for example, weather effects will create correlations within a day.</li>
<li>If we analyse data at the day level, then we have just 4 observations and obtain a p-value of <strong>0.072</strong>. This is the most conservative approach.</li>
<li>If regress sales on price, but cluster at the day level, then we get a p-value of <strong>0.023</strong>. In case others are interested, I did this using the STATA command <em>regress sales price, vce(cluster day)</em>.</li>
</ul>
<p>Notice that the p-value from the (?) correct approach, namely a clustered regression, lies between those obtained from the other two approaches.</p>

CC BY-SA 4.0
2023-07-18T10:31:08.430Z
2023-07-18T10:31:08.430Z
afreelunch
<p>Suppose that I sell ice cream and want to know whether charging \$1 or \$2 raises more revenue. To do this, I conduct a randomised price experiment. Specifically, on every day, I flip a coin and use that coin to determine whether the day’s price should be \$1 or \$2.</p>
<p>My question is how to analyse the results of this experiment. The most conservative approach would be to simply treat each day as a datapoint and compare revenue on \$1 days and \$2 days. That’s fine, but it makes the experiment very expensive to run. Indeed, to detect reasonable differences with conventional levels of power, one would need to run the experiment for at least several hundred days.</p>
<p>The least conservative approach would be to view the data as a series of (individual) customer level interactions. Specifically, one would pool all \$1 offers, pool all \$2 offers, and compare the share of offers that are accepted. One would then have a very large sample size, even if a small number of days. (For example, imagine that you only run the experiment for a couple of days, but that you offer an ice cream to thousands of customers on every day). One might then compare the two groups using a t-test (or equivalently, using linear regression). This will underestimate standard errors, however, since it neglects the fact that observations on a given day will be correlated (e.g. due to weather effects).</p>
<p>I believe that a ‘middle approach’ is possible and desirable. For example, one might analyse data on the customer level, but cluster standard errors at the day level. Am I right about this? (And is it actually different from what I calling the 'most conservative' approach?) Also, is there a textbook where I can learn more about these issues?</p>

<econometrics><randomized-experiment>
Analysing data from a randomised experiment where independence fails
afreelunch
# Analysing data from a randomised experiment where independence fails

(Asked by: username_0 on 2023-07-07)

Suppose that I sell ice cream and want to know whether charging \$1 or \$2 raises more revenue. To do this, I conduct a randomised price experiment. Specifically, on every day, I flip a coin and use that coin to determine whether the day’s price should be \$1 or \$2.

My question is how to analyse the results of this experiment. The most conservative approach would be to simply treat each day as a datapoint and compare revenue on \$1 days and \$2 days. That’s fine, but it makes the experiment very expensive to run. Indeed, to detect reasonable differences with conventional levels of power, one would need to run the experiment for at least several hundred days.

The least conservative approach would be to view the data as a series of (individual) customer level interactions. Specifically, one would pool all \$1 offers, pool all \$2 offers, and compare the share of offers that are accepted. One would then have a very large sample size, even if a small number of days. (For example, imagine that you only run the experiment for a couple of days, but that you offer an ice cream to thousands of customers on every day). One might then compare the two groups using a t-test (or equivalently, using linear regression). This will underestimate standard errors, however, since it neglects the fact that observations on a given day will be correlated (e.g. due to weather effects).

I believe that a ‘middle approach’ is possible and desirable. For example, one might analyse data on the customer level, but cluster standard errors at the day level. Am I right about this? (And is it actually different from what I calling the 'most conservative' approach?) Also, is there a textbook where I can learn more about these issues?

**Tags:** econometrics, randomized-experiment

---

## 3 answers

### Answer by username_1 on 2023-07-11. Score: 4

In terms of a textbook, The Handbook of Experimental Economics, John Kagel
and Alvin E. Roth, editors, Princeton University Press,
1995.

I'm not sure the customer-based approach is very feasible. Is the idea that many customers approach the ice cream stand each day, some buy, some don't buy, and your outcome is a binary variable for buying, with a regressor being the price on the day? It's not crazy, but I think in practice it wouldn't work. Customers will likely know the price on a day and only approach the stand if they are willing to buy. Thus, the outcome will almost always be 1.

This idea might be more feasible in an online setting in which the price shown on the website is randomized, and then some customers buy or not. Many online retailers do this to learn the demand curve they face.

In general, estimating demand curves is extremely hard. You can look up the Berry, Levinsohn, and Pakes (1995) method for the primary tool used by economists in non-experimental methods.

> **Comments:**
> **username_2**: I agree with the idea of the online setting. This is a much cleaner approach (you won't have issues regarding SUTVA), and it will allow you to maximise power (it is usually cheaper).  
> **username_0**: Thanks for the thoughts. However, I can't do the individual level randomisation in my setting.  

---

### Answer by username_2 on 2023-07-11. Score: 2

A way to find an answer to your question is to make identification assumptions clear. Here, you need the SUTVA to hold (and that might be problematic in your case):

**Consumers' decisions to buy an ice cream today are independent of the price of the ice cream in the past. In other words, you don't have spillover effects from one day to another.**

Then, if your treatment is perfectly randomised, the price on a given day $p\_t$ should be independent of the weather on that day $w\_t$ (or any other covariates you can think of). As such, when looking at the effect of price on the demand for ice cream (let's call it $D\_t$), you can simply run the following OLS:

$$D\_t = \alpha + \beta \cdot p\_t + \epsilon\_t$$

But for that, you will need perfect randomisation (i.e., price is independent of any covariates you might think of) and SUTVA to hold (i.e., only price in period $t$ affects decisions of period $t$).


---

### Answer by username_0 on 2023-07-18. Score: 0

I have just realised that this is just a cluster randomised trial (CRT). Usually, clusters are geographical units that are treated or not (e.g. different villages); here, however, the clusters are time units (days).

As I expected, the standard analysis of a CRT yields results between those from the 'most conservative' and 'least conservative' approaches discussed in the question. To illustrate, here is an example dataset. In the example, there are 4 days, evenly divided between the low price (\$1) and high price (\$2). Assume that, on every day, 12 customers approach the stall (without knowing the price in advance).

| Day | Price | Sales |
| --- | --- | --- |
| 1 | 1 | 10 |
| 2 | 2 | 5 |
| 3 | 1 | 12 |
| 4 | 2 | 7 |

On average, sales are 11 on low price days and 6 on high price days. How do we compare these numbers statistically?

* If we simply regress sales on price, which implicitly treats all units as independent, then we obtain a p-value of **0.001**. This is the least conservative approach and seems invalid: for example, weather effects will create correlations within a day.
* If we analyse data at the day level, then we have just 4 observations and obtain a p-value of **0.072**. This is the most conservative approach.
* If regress sales on price, but cluster at the day level, then we get a p-value of **0.023**. In case others are interested, I did this using the STATA command *regress sales price, vce(cluster day)*.

Notice that the p-value from the (?) correct approach, namely a clustered regression, lies between those obtained from the other two approaches.


---

