Fits Ghosh-Lin IPCW Cox-type model
recreg(
formula,
data = data,
cause = 1,
death.code = c(2),
cens.code = 0,
cens.model = ~1,
weights = NULL,
offset = NULL,
Gc = NULL,
wcomp = NULL,
...
)
formula with 'Event' outcome
data frame
of interest
codes for death (terminating event)
code of censoring (1 default)
for stratified Cox model without covariates
weights for score equations
offsets for model
censoring weights for time argument, default is to calculate these with a Kaplan-Meier estimator, should then give G_c(T_i-)
weights for composite outcome, so when cause=c(1,3), we might have wcomp=c(1,2).
Additional arguments to lower level funtions
For Cox type model : $$ E(dN_1(t)|X) = \mu_0(t)dt exp(X^T \beta) $$ by solving Cox-type IPCW weighted score equations $$ \int (Z - E(t)) w(t) dN_1(t) $$ where $$w(t) = G(t) (I(T_i \wedge t < C_i)/G_c(T_i \wedge t))$$ and $$E(t) = S_1(t)/S_0(t)$$ and $$S_j(t) = \sum X_i^j w_i(t) \exp(X_i^T \beta)$$.
The iid decomposition of the beta's are on the form $$ \int (Z - E ) w(t) dM_1 + \int q(s)/p(s) dM_c $$ and returned as iid.
Events, deaths and censorings are specified via stop start structure and the Event call, that via a status vector and cause (code), censoring-codes (cens.code) and death-codes (death.code) indentifies these. See example and vignette.
## data with no ties
data(base1cumhaz)
data(base4cumhaz)
data(drcumhaz)
Lam1 <- base1cumhaz; Lam2 <- base4cumhaz; LamD <- drcumhaz
## simulates recurrent events of types 1 and 2 and with terminal event D and censoring
rr <- simRecurrentII(100,Lam1,cumhaz2=Lam2,death.cumhaz=LamD,cens=3/5000)
rr <- count.history(rr)
rr$cens <- 0
nid <- max(rr$id)
rr$revnr <- revcumsumstrata(rep(1,nrow(rr)),rr$id-1,nid)
rr$x <- rnorm(nid)[rr$id]
rr$statusG <- rr$status
rr <- dtransform(rr,statusG=3,death==1)
dtable(rr,~statusG+status+death)
#>
#> death 0 1
#> statusG status
#> 0 0 46 0
#> 1 0 0
#> 2 0 0
#> 1 0 0 0
#> 1 162 0
#> 2 0 0
#> 2 0 0 0
#> 1 0 0
#> 2 22 0
#> 3 0 0 54
#> 1 0 0
#> 2 0 0
dcut(rr) <- gx~x
ll <- recreg(Event(start,stop,statusG)~x+cluster(id),data=rr,cause=1,death.code=3)
summary(ll)
#>
#> n events
#> 284 162
#>
#> 100 clusters
#> coeffients:
#> Estimate S.E. dU^-1/2 P-value
#> x 0.073331 0.095298 0.076609 0.4416
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> x 1.07609 0.89275 1.2971
#>
#>
## censoring stratified after quartiles of x
lls <- recreg(Event(start, stop, statusG)~x+cluster(id),data=rr,cause=1,
death.code=3,cens.model=~strata(gx))
summary(lls)
#>
#> n events
#> 284 162
#>
#> 100 clusters
#> coeffients:
#> Estimate S.E. dU^-1/2 P-value
#> x 0.051215 0.094866 0.076651 0.5893
#>
#> exp(coeffients):
#> Estimate 2.5% 97.5%
#> x 1.05255 0.87396 1.2676
#>
#>