Function to prepare data for the `quade`

function and hence the `qualCI`

function. Processes a data frame with set identifiers, treatment indicators, and within-set ranks, along with vector of between-set ranks to create a "`matchedSets`

" object.

1 | ```
quade.prep(data, set, treatment, withinRank, unit=NULL, betweenRank)
``` |

`data` |
an object of class " |

`set` |
the column name of |

`treatment` |
the column name of |

`withinRank` |
the column name of |

`unit` |
the column name of |

`betweenRank` |
a (named) numeric vector of between-set ranks. Names on vector should correspond to set identifiers. If |

Function for preparing data for the `quade`

function. Each set should contain at least one treated unit and at least one control unit.

Within-set ranks must consist of a sequence of consecutive integers starting with either 0 or 1. Ties are not permitted. Typical practice uses 0 and 1 to rank units in a matched pairs design and uses consecutive integers starting with 1 to rank units in a more general matched sets design.

Between-set ranks should be consecutive integers starting with 1. The names on the vector should correspond to the set nomenclature in `data[,set]`

.

`prepareData`

returns an object of class "`matchedSets`

", which is a named list of length equal to the number of sets. A given list element (corresponding to a set) consists of the following components:

`possibleTreat` |
a matrix of possible treatment vectors, where rows correspond to different treatment permutations and columns correspond to the units. |

`prob` |
a vector of probabilities corresponding to the probability of receiving a particular treatment permutation from the matrix of possible treatments. Length is equal to the number of rows in |

`obsTreat` |
a named vector denoting observed treatment status. |

`withinRank` |
a named vector denoting within-set ranks of units. |

`rank` |
numeric, denoting between-set rank of given set. |

Konstantin Kashin kkashin@fas.harvard.edu

1 2 3 4 5 6 7 8 9 10 11 12 | ```
data(pluralityPairs)
between.ranks <- c(3,4,2,1)
dat <- quade.prep(data=pluralityPairs, set="pair", treatment="plurality",
withinRank="OppHarRank", unit="country", betweenRank=between.ranks)
dat
data(pluralitySets)
between.ranks <- c(2,3,1)
dat <- quade.prep(data=pluralitySets, set="set", treatment="plurality",
withinRank="OppHarRank", unit="country", betweenRank=between.ranks)
dat
dat[[1]]
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.