Description Usage Arguments Value Examples
Sensitivity analysis with Matching, MatchIt and designmatch objects for a binary outcome.
1 2 |
x |
Treatment group outcomes or an objects from a Match,MatchIt or designmatch. |
y |
Control group outcomes in same order as treatment group outcomes such that members of a pair occupy the same row in both x and y. Should not be specified x is a Matching, MatchIt and designmatch objects. |
Gamma |
Upper bound of sensitivity parameter |
GammaInc |
interval width for increasing gamma from 1 until the specified upper bound of sensitivity parameter is reached. |
data |
Dataframe used to during matching. You do not have to specify this parameter if x is a MatchIt object |
treat |
Treatmetn/Exposure variable name. |
alpha |
p-value to define maximum upper bound allowable |
a table of Rosenbaum bounds
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ## Sensitivity analysis with a matchit object
library(Matching);library(MatchIt);library(designmatch)
data("GerberGreenImai",package = "Matching")
## Estimate Propensity Score
pscore.glm <- glm(PHN.C1 ~ PERSONS + VOTE96.1 + NEW +MAJORPTY + AGE + WARD + PERSONS:VOTE96.1 + PERSONS:NEW + AGE2, family = binomial(logit), data = GerberGreenImai)
## save data objects
D <- GerberGreenImai$PHN.C1
Y <- GerberGreenImai$VOTED98
X <- fitted(pscore.glm)
## Match - without replacement
m.obj <- Match(Y = Y, Tr = D, X = X, M = 1, replace=FALSE)
## Sensitivity Test
binarysens2(m.obj, Gamma=2, GammaInc=.1)
## Sensitivity analysis with a Match object
m.out = matchit(PHN.C1 ~ PERSONS + VOTE96.1 + NEW +MAJORPTY + AGE + WARD , family=binomial, data = GerberGreenImai, method = "nearest")
mod = lm(VOTED98 ~ PHN.C1+PERSONS + VOTE96.1 + NEW +MAJORPTY + AGE + WARD,data = match.data(m.out))
binarysens2(x=m.out,y ="VOTED98", Gamma=2, GammaInc=.1)
## Sensitivity analysis with a designmatch object
## data("GerberGreenImai",package = "Matching")
attach(GerberGreenImai)
## Treatment indicator
t_ind = PHN.C1
## Distance matrix
dist_mat = NULL
## Subset matching weight
subset_weight = 1
mom_covs = cbind(PERSONS,VOTE96.1 ,NEW , MAJORPTY , AGE , WARD)
mom_tols = round(absstddif(mom_covs, t_ind, .05), 2)
mom = list(covs = mom_covs, tols = mom_tols)
## Solver options
t_max = 60*5
solver = "glpk"
approximate = 1
solver = list(name = solver, t_max = t_max, approximate = approximate,round_cplex = 0, trace = 0)
## Match
out = bmatch(t_ind = t_ind, dist_mat = dist_mat, subset_weight = subset_weight,mom = mom,solver = solver)
binarysens2(x=out,y ="VOTED98", Gamma=2, GammaInc=.1,treat = "PHN.C1",data = GerberGreenImai)
detach(GerberGreenImai)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.