C.for.Benefit: C-for-benefit

Description Usage Arguments Value Examples

View source: R/CforBenefit.R

Description

This function calculates the C-for-benefit, as proposed by D. van Klaveren et al. (2018), by matching patients based on patient characteristics.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
C.for.Benefit(
  Y = NULL,
  W = NULL,
  X = NULL,
  p.0 = NULL,
  p.1 = NULL,
  tau.hat = NULL,
  CI = FALSE,
  nr.bootstraps = 1,
  message = TRUE,
  measure = "nearest",
  distance = "mahalanobis",
  ...
)

Arguments

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

Value

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).

Examples

 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

CHMMaas/CforBenefit documentation built on Dec. 24, 2021, 12:12 a.m.