generate_causal_survival_data {grf}R Documentation

Simulate causal survival data

Description

The following DGPs are available for benchmarking purposes, T is the failure time and C the censoring time:

Usage

generate_causal_survival_data(
  n,
  p,
  Y.max = NULL,
  y0 = NULL,
  X = NULL,
  rho = 0,
  n.mc = 10000,
  dgp = c("simple1", "type1", "type2", "type3", "type4", "type5")
)

Arguments

n

The number of samples.

p

The number of covariates.

Y.max

The maximum follow-up time (optional).

y0

Query time to estimate P(T(1) > y0 | X) - P(T(0) > y0 | X) (optional).

X

The covariates (optional).

rho

The correlation coefficient of the X's covariance matrix V_(ij) = rho^|i-j|. Default is 0.

n.mc

The number of monte carlo draws to estimate the treatment effect with. Default is 10000.

dgp

The type of DGP.

Value

A list with entries: 'X': the covariates, 'Y': the event times, 'W': the treatment indicator, 'D': the censoring indicator, 'cate': the treatment effect (RMST) estimated by monte carlo, 'cate.prob' the difference in survival probability, 'cate.sign': the true sign of the cate for ITR comparison, 'dgp': the dgp name, 'Y.max': the maximum follow-up time, 'y0': the query time for difference in survival probability.

Examples


# Generate data
n <- 1000
p <- 5
data <- generate_causal_survival_data(n, p)
# Get true CATE on a test set
X.test <- matrix(seq(0, 1, length.out = 5), 5, p)
cate.test <- generate_causal_survival_data(n, p, X = X.test)$cate



[Package grf version 2.3.2 Index]