pairmatch()
or fullmatch()
can determine optimal matches.pscore.dist(glmobject, structure.fmla = NULL, standardization.scale=sd)
glm()
or, say, bayesglm
(from package
brglm()
(from the NULL
,
defaulting to sd
.optmatch.dlist
, which is suitable to be given
as distance
argument to fullmatch
or
pairmatch
. Specifically, a list of matrices, one for each subclass defined by the
interaction of variables appearing on the right hand side of
structure.fmla
. Each of these is a number of treatments by
number of controls matrix of propensity distances. The distances are
differences of the linear predictor from the propensity model, rather than
differences of estimated probabilities, avoiding compression of
estimated propensities near 0 and 1 (Rosenbaum and Rubin, 1985). They will
have been scaled by the pooled SD of propensity scores in the
treatment and control groups, so that a caliper of .25 pooled SDs on
the propensity score can be coded as value/(value<=.25)< code="">; see
the examples.
The list also carries some metadata as attributes, data that are not of direct interest to
the user but are useful to
fullmatch()
and pairmatch()
.=.25)<>
glmobject
need not necessarily be the result of a call to
glm
. It should be a list with elements: y
, a vector that
is positive for treatment subjects and nonpositive for controls;
linear.predictors
, containing the propensity scores; and
data
, the data frame from which propensities were made.
The purpose of giving a structure.fmla
argument is to speed
up large problems. Variables appearing on its
right-hand side will be interacted to create these subclasses; the
same variables should also have appeared on the RHS of the formula
used to specify the propensity model. If non-null, argument
standardization.scale
should be a scalar-valued function of a
vector argument. It is applied separately to
treatment and control propensity scores to determine their scale;
propensity distances will be scaled by a pooling of these two values.
If NULL
, no scaling is supplied, and distances are in terms
of the linear propensity score, that is the logits of the
conditional probabilities. (Another good choice is mad
,
which is robust to outliers but gives results similar to sd
in the absence of outliers.)
Underneath, the function makes use of makedist
. So it keeps track of
metadata useful for matching, as described on the help page for that function.
makedist
, mahal.dist
, fullmatch
, pairmatch
,
caliper
data(nuclearplants)
psm <- glm(pr~.-(pr+cost), family=binomial(), data=nuclearplants)
psd <- pscore.dist(psm)
fullmatch(psd)
fullmatch(caliper(.25, psd)) # Propensity matching with calipers
Run the code above in your browser using DataLab