Title: | Structural Additive Cumulative Intensity Models with IV |
---|---|
Description: | An instrumental variable estimator under structural cumulative additive intensity model is fitted, that leverages initial randomization as the IV. The estimator can be used to fit an additive hazards model under time to event data which handles treatment switching (treatment crossover) correctly. We also provide a consistent variance estimate. |
Authors: | Andrew Ying |
Maintainer: | Andrew Ying <[email protected]> |
License: | GPL (>= 2) |
Version: | 2.1.0 |
Built: | 2024-11-19 06:46:58 UTC |
Source: | CRAN |
ivsacim is used to fit cumulative intensity models for exposure effects with instrumental variables.
ivsacim( time, event, instrument, IV_valid = TRUE, treatment_init, treatment_shift_time = NULL, max_time = NULL, max_time_bet = NULL, n_sim = 0, weights = NULL )
ivsacim( time, event, instrument, IV_valid = TRUE, treatment_init, treatment_shift_time = NULL, max_time = NULL, max_time_bet = NULL, n_sim = 0, weights = NULL )
time |
the censored event time |
event |
event indicator |
instrument |
the instrumental variable |
IV_valid |
whether assuming IV satisfies the exclusion restriction |
treatment_init |
the initial treatment assignment |
treatment_shift_time |
the shift time of each subject, if no shift for a subject, set as 0 |
max_time |
the max time that we threshold for nonconstant effect |
max_time_bet |
the max time that we threshold for constant effect |
n_sim |
the number of resampling, set as 0 if no resampling is needed |
weights |
optional weights used in the estimating equation |
ivsacim returns an object of class "ivsacim". An object of class "ivsacim" is a list containing the following components:
stime |
an estimate of the baseline hazards function |
dB_D |
an estimate of the increment of the treatment effect |
B_D |
an estimate of the treatment effect |
beta_D |
an estimate of the constant treatment effect |
B_D_se |
an estimate of the variance covariance matrix of B_D |
beta_D_se |
an estimate of the constant treatment effect |
by_prod |
a byproduct, that will used by other functions |
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 0 fit <- ivsacim(time, event, IV, TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim)
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 0 fit <- ivsacim(time, event, IV, TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim)
The function will plot the estimated cumulative intensity function of the treatment after fitting. Corresponding pointwise confidence intervals at level alpha are also included.
## S3 method for class 'ivsacim' plot(x, gof = FALSE, ...)
## S3 method for class 'ivsacim' plot(x, gof = FALSE, ...)
x |
the fitting object after fitting IVSACIM model |
gof |
whether to draw the goodness-of-fit plot |
... |
the other arguments you want to put in the built-in plot function |
No return value, called for side effects
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 100 fit <- ivsacim(time, event, IV, IV_valid = TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim) plot(fit, main = "", xlab = "Time", ylab = "Cumulative Intensity Function") plot(fit, gof = TRUE, xlab = "Time", ylab = "")
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 100 fit <- ivsacim(time, event, IV, IV_valid = TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim) plot(fit, main = "", xlab = "Time", ylab = "Cumulative Intensity Function") plot(fit, gof = TRUE, xlab = "Time", ylab = "")
summary method for class "ivsacim".
## S3 method for class 'ivsacim' summary(object, ...) ## S3 method for class 'summary.ivsacim' print(x, ...)
## S3 method for class 'ivsacim' summary(object, ...) ## S3 method for class 'summary.ivsacim' print(x, ...)
object |
an object of class "ivsacim", usually, a result of a call to ivsacim. |
... |
further arguments passed to or from other methods. |
x |
an object of class "summary.ivsacim", usually, a result of a call to summary.ivsacim. |
print.summary.ivsacim tries to be smart about formatting coefficients, an estimated variance covariance matrix of the coeffieients, Z-values and the corresponding P-values.
The function summary.ivsacim computes and returns a list of summary statistics of the fitted model given in object.
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 0 fit <- ivsacim(time, event, IV, IV_valid = TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim) summary(fit)
n = 400 event = rbinom(n, 1, 0.8) IV = rbinom(n, 1, 0.5) trt_init = IV trt_shift = rep(0, n) time = rexp(n)/(0.5 + trt_init * 0.2) max_t = 3 max_t_bet = 3 n_sim = 0 fit <- ivsacim(time, event, IV, IV_valid = TRUE, trt_init, trt_shift, max_t, max_t_bet, n_sim) summary(fit)