# compliance.score: Estimate compliance scores using covariates. In kylepeyton/icsw: Inverse Compliance Score Weighting

## Description

Estimate probability that units are compliers using generalized linear models for probability of being a complier or always-taker and for being an always-taker conditional on being a complier or always-taker. These compliance scores can be used in inverse probability weighting to estimate average treatment effects. In the case of one-sided non-compliance, this estimation is considerably simpler.

## Usage

 ```1 2 3 4``` ```compliance.score(D, Z, W, weights = NULL, link = qnorm, inv.link = pnorm, genoud = TRUE, num.iter = ifelse(genoud, 200, 10000), one.sided = FALSE) ```

## Arguments

 `D` Binary treatment of interest. `Z` Binary instrument. `W` Matrix of covariates for compliance model. `weights` Observation weights. `link` Link function applied for linear models. Defaults to probit link function. `inv.link` Inverse link function (i.e., mean function) applied for linear models. Defaults to probit mean function. `genoud` Whether to use global optimization via genetic optimization from package `rgenoud`. Default, and highly recommended because the likelihood need not be concave. Otherwise, use the BOBYQA algorithm for constrained optimization from package `minqa`. `num.iter` Number of iterations of optimization routine. `one.sided` Whether non-compliance is one-sided (logical). When compliance is one-sided, the previous four arguments are ignored, and the compliance scores are estimated with probit regression.

## Details

A unit i is a complier if D_{i1} > D_{i0}, where D_{i1} and D_{i0} are the potential treatments for unit i when Z is set to 1 and 0. This is a latent (unobserved) characteristic of individual units, since each unit is only observed with one value of Z.

By default this function uses genetic optimization via `genoud` because the loss function for the complier scores is not necessarily convex.

## Value

Vector of estimated probabilities of being a complier (i.e., compliance scores).

## Note

Requires `rgenoud` package if `genoud` = TRUE. Requires `minqa` package if `genoud` = FALSE.

## Author(s)

Peter M. Aronow <peter.aronow@yale.edu>, Dean Eckles <icsw@deaneckles.com>, Kyle Peyton <kyle.peyton@yale.edu>

## References

Peter M. Aronow and Allison Carnegie. (2013). Beyond LATE: Estimation of the average treatment effect with an instrumental variable. Political Analysis.

Used by `icsw.tsls`.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15``` ```# Load example dataset, see help(FoxDebate) for details data(FoxDebate) # Matrix of covariates covmat <- with(FoxDebate, cbind(partyid, pnintst, watchnat, educad, readnews, gender, income, white)) # Estimate compliance scores with covariates, assuming (default) # case of two-sided non-compliance cscoreout <- with(FoxDebate, compliance.score(D = watchpro, Z = conditn, W = covmat)) # Extract vector of estimated compliance scores cscore <- cscoreout\$C.score summary(cscore) ```