Learn R Programming

optmatch (version 0.6-0)

caliper: Prepare matching distances suitable for matching within calipers

Description

Encodes calipers, or maximum allowable distances within which to match, calling mdist() on the supplied arguments to calculate the distance on which the caliper is based. (One then applies pairmatch() or fullmatch() to the value of caliper, or to the sum of it and another distance, to match within calipers.)

Usage

caliper(width, ..., exclude = c(), penalty = Inf)

Arguments

width
The width of the caliper: how wide of a margin to allow in matches.
...
Arguments are passed to mdist(), which forms the basic distance matrix. The caliper is then fit to this matrix. See mdist for more information.
exclude
A character vector of observations (corresponding to rownames) to exclude from the caliper.
penalty
Attach a penalty (to be mulitplied to the distance value) for pairs outside of the caliper. The default of Inf prevents matches between such pairs; finite values of penalty permit such matches but discourage them.

Value

  • Object of class optmatch.dlist, which is suitable to be given as distance argument to fullmatch or pairmatch. For more information, see pscore.dist

Details

width provides the size of the caliper, the allowable distance for matching. The unit of width will depend on the additional arguments, used to create a basic distance matrix using mdist. For a forumla, width will be in the unit of the selected covariate. For a GLM x argument, the width will be relative to the computed propensity score. Careful consideration should be given to what this unit means in your analysis. Similarly, a previous matching matrix will use those units.

References

P.~R. Rosenbaum and D.~B. Rubin (1985), Constructing a control group using multivariate matched sampling methods that incorporate the propensity score, The American Statistician, 39 33--38.

See Also

mdist, fullmatch, pairmatch

Examples

Run this code
data(nuclearplants)

### Caliper  of .2 pooled SDs in the propensity score
ppty <- glm(pr~.-(pr+cost), family=binomial(), data=nuclearplants)
(pptycaliper <- caliper(ppty, width = .2))

identical(pptycaliper,  # If not writing 'width=',
caliper(.2,ppty))        # give your width first.

### Caliper on a pre-formed distance
ppty.dist <- mdist(ppty) 
identical(caliper(ppty.dist, width = .2), pptycaliper)

### caliper on the Mahalanobis distance
caliper(width = 3, pr ~ t1 + t2, data = nuclearplants)             

### Mahalanobis distance matching with a caliper
### of 1 pooled SD in the propensity score:
( mhd.pptyc <- caliper(ppty, width = 1) +
  mdist(pr ~ t1 + t2, data = nuclearplants) )
pairmatch(mhd.pptyc)

### Excluding observations from caliper requirements:
caliper(width = 3, pr ~ t1 + t2, data = nuclearplants, exclude = c("A", "f"))

Run the code above in your browser using DataLab