Learn R Programming

nonrandom (version 1.42)

ps.match: Propensity score matching

Description

Matching based on the estimated propensity score

Usage

ps.match(object, object.control=NULL, matched.by=NULL,
 control.matched.by=matched.by, who.treated=1, treat=NULL,
 name.match.index="match.index", ratio=1, caliper="logit", x=0.2,
 givenTmatchingC=TRUE, bestmatch.first=TRUE, setseed=FALSE,
 combine.output=TRUE)

Arguments

object
an object of class 'pscore' or a data frame.
object.control
a data frame. It is needed if object is a data frame including only treated or untreated observations, respectively.
matched.by
an integer or a string indicating the matching variable. The default is NULL, i.e. if the class of the input object is 'pscore', object value 'pscore' is automatically used.
control.matched.by
an integer or a string indicating the matching variable in object.control. The default is 'matched.by'.
who.treated
an integer or a string indicating which value of treat labels the 'treated' observations.
treat
an integer or a string indicating the treatment variable in data both of object and object.control. If the class of the input object is 'pscore', no specification is needed.
name.match.index
a string indicating the name of the variable containing the matching indices.
ratio
an integer k indicating the matching ratio 1:k.
caliper
an integer or a string indicating the maximum width of the caliper for which matching should be done. The default is 'logit', i.e. the maximum width of the caliper is x of the standard deviation of the logit of the matching variab
x
a numeric value indicating the scale parameter for the calculation of the caliper if caliper='logit'.
givenTmatchingC
a logical value indicating who is matched to whom. The default is 'TRUE', i.e. untreated observations are matched to treated observations.
bestmatch.first
a logical value indicating how potential matching partners are matched. The default is 'TRUE', i.e. observations are matched with the best accordance regarding the matching variable. Otherwise, matching partners are randomly assigned from
setseed
an integer setting a random number for the matching process.
combine.output
a logical value. The default is 'TRUE', i.e. if object and object.control are given, 'data', 'data.matched' and 'match.index' are combined as data frames or a vector, respectively. If 'FALSE', these values are returne

Value

  • ps.match() returns an object of class 'matched.pscore', 'matched.data.frame' or 'matched.data.frames' depending on the class(es) of the input object(s) and combine.output. If the class of the input object is 'pscore', the output object inherits all components from the input object. The following components are available:
  • dataa data frame containing the input data, extended by column(s) including the matching indices labeled by name.match.index. If the input object is a data frame, 'data' are sorted by treatment. If object.control is given and combine.output='FALSE', 'data' is a list of two data frames corresponding to the input objects.
  • data.matcheda data frame limiting 'data' only to matched observations.
  • matched.bya string indicating the name of the matching variable.
  • name.match.indexa string indicating the name of matching indices generated at last.
  • match.indexa numeric vector containing the matching indices labeled by 'name.match.index' whereas '0' indicates 'no matching partner found'. If combine.output='FALSE', it is a list of two vectors corresponding to the input objects.
  • match.parametersa list of matching parameters (caliper, ratio, who.treated, givenTmatchingC, bestmatch.first).
  • formula.pscorea formula describing formally the propensity score model fitted at last in pscore().
  • model.pscorean object of class glm containing information about the propensity score model fitted at last in pscore().
  • name.pscorea string indicating the name of propensity score estimated at last in pscore().
  • pscorea numeric vector containing the estimated propensity score labeled by name.pscore.
  • name.treata string indicating the name of the selected treatment variable.
  • treata numeric vector containing the treatment index labeled by name.treat.

Details

Matching by the estimated propensity score creates matching sets in which treated and untreated observations have identical or similar estimated propensity score. One or more untreated observations will be matched to each treated observation or vice versa.

The caliper, i.e. the maximum distance between the estimated propensity scores of treated and untreated observations to be matched is generally defined as x=0.2 of the standard deviation of the (caliper)=logit of the estimated propensity score. If function pscore() is previously used with default settings, matched.by has not to be specified. It is needed, if the matching variable in data is not labeled by 'pscore'. Also treat has not to be specified, contrary to the case where one or two data frames are given as input objects.

Examples

Run this code
## STU1
data(stu1)
stu1.ps <- pscore(data    = stu1, 
                  formula = therapie~tgr+age)
stu1.match <- ps.match(object          = stu1.ps,
                       ratio           = 2,
                       caliper         = 0.5,
                       givenTmatchingC = FALSE,
                       matched.by      = "pscore",
                       setseed         = 38902)

Run the code above in your browser using DataLab