ps.match: Propensity score matching

Description Usage Arguments Details Value Author(s) Examples

View source: R/ps.match.R

Description

Matching based on the estimated propensity score

Usage

1
2
3
4
5
6
7
 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 variable.

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 the pool of potential matching candidates.

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 returned as lists with entries corresponding to the input objects.

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.

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:

data

a 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.matched

a data frame limiting 'data' only to matched observations.

matched.by

a string indicating the name of the matching variable.

name.match.index

a string indicating the name of matching indices generated at last.

match.index

a 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.parameters

a list of matching parameters (caliper, ratio, who.treated, givenTmatchingC, bestmatch.first).

formula.pscore

a formula describing formally the propensity score model fitted at last in pscore().

model.pscore

an object of class glm containing information about the propensity score model fitted at last in pscore().

name.pscore

a string indicating the name of propensity score estimated at last in pscore().

pscore

a numeric vector containing the estimated propensity score labeled by name.pscore.

name.treat

a string indicating the name of the selected treatment variable.

treat

a numeric vector containing the treatment index labeled by name.treat.

Author(s)

Susanne Stampf susanne.stampf@usb.ch

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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)

Example output

Loading required package: lme4
Loading required package: Matrix
Argument 'givenTmatchingC'=FALSE: Treated elements were matched to each untreated element.

nonrandom documentation built on May 29, 2017, 11:41 p.m.