Description Usage Arguments Value Examples
This function calculates the C-for-benefit, as proposed by D. van Klaveren et al. (2018), by matching patients based on patient characteristics.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Y |
a vector of outcomes |
W |
a vector of treatment assignment; 1 for active treatment; 0 for control |
X |
a matrix of patient characteristics |
p.0 |
a vector of outcome probabilities under control |
p.1 |
a vector of outcome probabilities under active treatment |
tau.hat |
a vector of individualized treatment effect predictions |
CI |
boolean; TRUE compute confidence interval; default=FALSE do not compute confidence interval (default=FALSE) |
nr.bootstraps |
boolean; number of bootstraps to use for confidence interval computation (default=1) |
message |
boolean; TRUE display computation time message; FALSE do not display message (default=TRUE) |
measure |
measure option of matchit function from MatchIt package (default="nearest") |
distance |
distance option of matchit function from MatchIt package (default="mahalanobis) |
... |
additional arguments for matchit function from MatchIt package |
The output of the C.for.benefit function is a ‘list’ with the following components.
matched.patients
a dataframe containing the matched patients.
c.for.benefit
the resulting C-for-benefit value.
lower.CI
the lower bound of the confidence interval (if CI = TRUE).
upper.CI
the upper bound of the confidence interval (if CI = TRUE).
1 2 3 4 5 6 7 8 9 10 11 | n <- 100
Y <- sample(0:1, n, replace=TRUE)
W <- sample(0:1, n, replace=TRUE)
X <- matrix(rnorm(n), n, 3)
p.0 <- runif(n)
p.1 <- runif(n)
tau.hat <- runif(n)
CB.out <- C.for.Benefit(Y=Y, W=W, X=X, p.0=p.0, p.1=p.1, tau.hat=tau.hat,
CI=TRUE, nr.bootstraps=100, message=TRUE,
measure="nearest", distance="mahalanobis")
CB.out
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.