dsmatchQTE: Double Score Matching Estimator for Quantile Treatment...

Description Usage Arguments Details Value Examples

View source: R/dsmatchQTE.R

Description

dsmatchQTE applys matching algorithm to estimate quantile treatment effect based on propensity score and prognostic score. Classical matching algortihms, including propensity score matching, prognositc score matching and matching directly on covarites are also contained for comparison. Covariate balance results are also provided.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
dsmatchQTE(
  Y,
  X,
  A,
  p,
  method = "dsm",
  model.ps = "other",
  ps = NULL,
  lp.ps = NULL,
  model.pg = "other",
  pg = NULL,
  lp.pg = NULL,
  cov.balance = F,
  varest = F,
  boots = 100,
  mc = F,
  ncpus = 4
)

Arguments

Y

Outcome as numeric vector.

X

Covarites as numeric vector or matrix.

A

Treatment assignment as numeric vector with 1 stands for treatment group and 0 stands for control group.

p

Quantile to be estimated. Must be a numeric scalar between 0 and 1.

method

Matching method to use, including "dsm" as double score matching, "ps" as propensity score matching, "pg" as prognostic score matching and "cov" as matching on covariates directly.

model.ps

Fitted model for propensity score, including "logit" as logistic model, "probit" as probit model, "linpred" as logistic model with linear predictors specified by "lp.ps". Don't need to be specified if ps is given.

ps

Propensity score as numeric vector given by user. Don't need to be specified if model.ps is given.

lp.ps

Linear predictors for propensity score as numeric vector or matrix. Don't need to be specified if model.ps is not "linpred".

model.pg

Fitted model for prognostic score, including "glm" as linear model for continuous outcome, "glm_logit" as logistic model for binary outcome, "glm_probit" as probit model for binary outcome, "linpred" as linear model for continuous outcome with linear predictors specified by "lp.pg", "zir_logit" as zero inflated model using logistic model to fit non-zero probability, "zir_probit" as zero inflated model using probit model to fit non-zero probability. Don't need to be specified if pg is given.

pg

Prognostic score as numeric matrix given by user. The first column is potential outcome for control group and the second column is potential outcome for treatment group. Don't need to be specified if model.pg is given.

lp.pg

Linear predictors for prognostic score as numeric vector or matrix. Don't need to be specified if model.pg is not "linpred".

cov.balance

A logical scalar for whether covariance balance results should be shown.

varest

A logical scalar for whether variance of estimator should be estimated.

boots

A numeric scalar for number of bootstrap relicates in variance estimation. Don't need to be specified if varest is F.

mc

A logical scalar for whether multiple cores are used in variance estimation. Don't need to be specified if varest is F.

ncpus

A numeric scalar for number of cores used in variance estimation. Don't need to be specified if varest is F.

Details

For both propensity socre and prognostic score, user should either select a model or provide the score directly. If linear predictors are used to fit a logistic model for propensity score or a linear model for prognostic score, they should be determined by lp.ps or lp.pg argument. If model.ps (and lp.ps if linear predictors are used) is given, then ps does not need to be specified, and vice versa. However, if propensity socre is given by ps while model.ps is chosen at the same time, the model will be ignored and matching will be based on the score given by the user directly. A warning will be thrown if this situation happens. Similar results for prognostic score.

A special model for prognostic score is the zero inflated regression model, which fits a logistic model for the probability to be zero, and a regression model for the non-zero values.

Value

Results are put in a list:

est.ds

Point estimate of ATE if matching is based on double score

est.ps

Point estimate of ATE if matching is based on propensity score

est.pg

Point estimate of ATE if matching is based on prognostic score

est.x

Point estimate of ATE if matching is based on covarites directly

boot.var

Variance of estimator estimated by bootstrap. Meaningless if varest if F.

bootq1

0.025 quantile of estimator estimated by bootstrap. Meaningless if varest if F.

bootq2

0.975 quantile of estimator estimated by bootstrap. Meaningless if varest if F.

Examples

 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
# import lalonde data from package "Matching"
library(Matching)
data("lalonde")
Y = lalonde[,"re78"]
X = lalonde[,c("age","educ","black","hisp","married","nodegr","re74","re75","u74","u75")]
X = as.matrix(X)
A = lalonde[,"treat"]

# linear predictors using in the algorithm
# take logarithm for income and standardize covariates
Z = X
Z[,"re74"] = log(Z[,"re74"] + 1)
Z[,"re75"] = log(Z[,"re75"] + 1)
Z[,"age"] = (Z[,"age"] - mean(Z[,"age"])) / sd(Z[,"age"])
Z[,"educ"] = (Z[,"educ"] - mean(Z[,"educ"])) / sd(Z[,"educ"])
Z[,"re74"] = (Z[,"re74"] - mean(Z[,"re74"])) / sd(Z[,"re74"])
Z[,"re75"] = (Z[,"re75"] - mean(Z[,"re75"])) / sd(Z[,"re75"])
Z = cbind(Z, Z[,"age"]^2, Z[,"educ"]^2, Z[,"re74"]^2, Z[,"re75"]^2)

# estimate ATT using four matching methods
set.seed(1)
dsmatchATE(Y, X, A, method = "dsm", model.ps = "linpred", lp.ps = Z, model.pg = "linpred", lp.pg = Z, varest = T, cov.balance = T)
dsmatchATE(Y, X, A, method = "ps", model.ps = "linpred", lp.ps = Z, model.pg = "linpred", lp.pg = Z, varest = T, cov.balance = T)
dsmatchATE(Y, X, A, method = "pg", model.ps = "linpred", lp.ps = Z, model.pg = "linpred", lp.pg = Z, varest = T, cov.balance = T)
dsmatchATE(Y, X, A, method = "cov", model.ps = "linpred", lp.ps = Z, model.pg = "linpred", lp.pg = Z, varest = T, cov.balance = T)

# estimate QTE using double score matching
p = 0.3
set.seed(1)
res <- dsmatchQTE(Y, X, A, p, method = "dsm", model.ps = "linpred", lp.ps = Z, model.pg = "linpred", lp.pg = Z, varest = T)
res
# Wald interval for QTE
res$est.ds + qnorm(0.025) * sqrt(res$bootvar)
res$est.ds - qnorm(0.025) * sqrt(res$bootvar)

Yunshu7/dsmatch documentation built on Sept. 18, 2020, 6:20 p.m.