GK2011

Gaines and Kuklinski (2011) Estimators for Hybrid Experiments

https://github.com/leeper/gk2011

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (7.4%) to scientific vocabulary

Keywords

cran experiment r rct self-selection treatment-effects
Last synced: 6 months ago · JSON representation

Repository

Gaines and Kuklinski (2011) Estimators for Hybrid Experiments

Basic Info
Statistics
  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Topics
cran experiment r rct self-selection treatment-effects
Created over 9 years ago · Last pushed almost 8 years ago
Metadata Files
Readme Contributing

README.Rmd

# Gaines and Kuklinski (2011) Estimators for Hybrid Experiments

**GK2011** is a package for providing implementations of the treatment effect estimators for hybrid (self-selection) experiments, as developed by Gaines and Kuklinski (2011).

These functions estimate local average treatment effects for unobserved population subgroups inclined and disinclined to be treated, as revealed by a three-condition (two-arm) "hybrid" experimental design. In the design, participants are randomly assigned to one of three conditions: 1) treatment (T), 2) control (C), or 3) self-selection (S) of treatment or control. The design enables the estimation of four treatment effects:

 1. The sample average treatment effect,
 2. The effect for those inclined to choose treatment,
 3. The effect for those disinclined to choose treatment (or, equivalent, to inclined to choose control), and
 4. The naive difference in the outcome between those who chose treatment rather than control.



## Code Examples

The only function is `estimate()`, which provides a simple interface for estimating all effects:

```{r}
library("GK2011")

# create fake data
set.seed(12345)
d <- 
data.frame(rand = c(rep(1, 200), rep(0, 100)),
           tr = c(rep(0, 100), rep(1, 100), rep(0, 37), rep(1, 63)),
           y = c(rnorm(100), rnorm(100) + 1, rnorm(37), rnorm(63) + 3))

# estimate effects
estimate(rand = d$rand, tr = d$tr, y = d$y)
```

The response structure is a data.frame containing the name of each effect, the effect estimate, and bootstrapped standard error.

### Gaines and Kuklinski's data

A small example dataset is included that contains treatment and outcome data from Gaines and Kuklinski's (2011) study. The following code replicate the main descriptive results from Table 2 of their paper:

```{r}
data(ajps)
pmean <- function(x) sprintf("%0.1f", mean(x))
cbind(
  # Democrats
  aggregate(cbind(therm.mccain, therm.obama) ~ tr, data = ajps[ajps$pid == 1, ], FUN = pmean)[, 1:3],
  n_dem = aggregate(therm.obama ~ tr, data = ajps[ajps$pid == 1, ], FUN = length)[, 2],
  # Republicans
  aggregate(cbind(therm.mccain, therm.obama) ~ tr, data = ajps[ajps$pid == -1, ], FUN = pmean)[, 2:3],
  n_rep = aggregate(therm.obama ~ tr, data = ajps[ajps$pid == -1, ], FUN = length)[, 2]
)
```

The paper reports four main sets of experimental results, separating the experiment by outcome (feeling thermometers for Obama and McCain) and by respondents' party identification (Democrats and Republicans).


Here are effects for McCain among Democrats:

```{r}
with(ajps[ajps$pid == 1, ], {
  estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.mccain)
})
```

Here are effects for McCain among Republicans:

```{r}
with(ajps[ajps$pid == -1, ], {
  estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.mccain)
})
```

Here are effects for Obama among Democrats:

```{r}
with(ajps[ajps$pid == 1, ], {
  estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.obama)
})
```

Here are effects for Obama among Republicans:

```{r}
with(ajps[ajps$pid == -1, ], {
  estimate(rand = tr %in% 1:2, tr = tr %in% c(1,3), y = therm.obama)
})
```


## Installation

[![CRAN](https://www.r-pkg.org/badges/version/GK2011)](https://cran.r-project.org/package=GK2011)
[![Build Status](https://travis-ci.org/leeper/GK2011.png?branch=master)](https://travis-ci.org/leeper/GK2011)
[![codecov.io](https://codecov.io/github/leeper/GK2011/coverage.svg?branch=master)](https://codecov.io/github/leeper/GK2011?branch=master)

This package is not yet on CRAN. To install the latest development version you can pull directly from GitHub:

```R
if(!require("remotes")){
    install.packages("remotes")
}
remotes::install_github("leeper/GK2011")
```


## References

Brian J. Gaines and James H. Kuklinski, (2011), "Experimental Estimation of Heterogeneous Treatment Effects Related to Self-Selection," *American Journal of Political Science* 55(3): 724-736, doi:10.1111/j.1540-5907.2011.00518.x.

Owner

  • Name: Thomas J. Leeper
  • Login: leeper
  • Kind: user
  • Location: London, United Kingdom

Behavioral scientist and R hacker

GitHub Events

Total
Last Year

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 13
  • Total Committers: 1
  • Avg Commits per committer: 13.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Thomas J. Leeper t****r@g****m 13

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: about 11 hours
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • leeper (1)
Pull Request Authors
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 189 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 1
  • Total maintainers: 1
cran.r-project.org: GK2011

Gaines and Kuklinski (2011) Estimators for Hybrid Experiments

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 189 Last month
Rankings
Forks count: 21.9%
Stargazers count: 28.5%
Dependent packages count: 29.8%
Dependent repos count: 35.5%
Average: 36.7%
Downloads: 68.0%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • stats * imports
  • testthat * suggests