quade.prep: Prepare data for qualitative causal inference.

Description Usage Arguments Details Value Author(s) Examples

Description

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.

Usage

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

Arguments

data

an object of class "data.frame" containing set, treatment, and within-set rank variables.

set

the column name of data that contains the set identifier. It cannot contain any NAs.

treatment

the column name of data that contains the treatment indicator. Treatment indicator must be binary and cannot contain any NAs.

withinRank

the column name of data that contains the within-set ranks. It cannot contain any NAs and must be numeric. See below for details.

unit

the column name of data that contains the unit names. May be set to NULL, in which case the unit's name is set to its within-set position.

betweenRank

a (named) numeric vector of between-set ranks. Names on vector should correspond to set identifiers. If betweenRank object has no names attribute, an element's name is set to its position in the vector.

Details

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].

Value

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 possibleTreat.

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.

Author(s)

Konstantin Kashin kkashin@fas.harvard.edu

Examples

 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]]

qualCI documentation built on May 2, 2019, 6:51 a.m.

Related to quade.prep in qualCI...