pseudo.twodim {recurrentpseudo} | R Documentation |
Function that computes bivariate pseudo-observations
Description
This function computes bivariate pseudo-observations of the marginal mean function (in the presence of terminal events) and the survival probability
Usage
pseudo.twodim(tstart, tstop, status, covar_names, id, tk, data)
Arguments
tstart |
Start time - expecting counting process notation |
tstop |
Stop time - expecting counting process notation |
status |
Status variable (0 = censoring, 1 = recurrent event, 2 = death) |
covar_names |
Vector containing names of covariates intended for further analysis |
id |
ID variable for subject |
tk |
Vector of time points to calculate pseudo-observations at |
data |
Data set which contains variables of interest |
Value
An object of class pseudo.twodim
.
outdata
contains the semi-wide version of the computed pseudo-observations (one row per time, tk, per id).outdata_long
contains the long version of the computed pseudo-observations (one row per observation, several per id).indata
contains the input data which the pseudo-observations are based on.ts
vector with time points used for computation of pseudo-observations.k
number of time points used for computation of pseudo-observations (length(ts)).
References
Furberg, J.K., Andersen, P.K., Korn, S. et al. Bivariate pseudo-observations for recurrent event analysis with terminal events. Lifetime Data Anal (2021). https://doi.org/10.1007/s10985-021-09533-5
Examples
# Example: Bladder cancer data from survival package
require(survival)
# Make a three level status variable
bladder1$status3 <- ifelse(bladder1$status %in% c(2, 3), 2, bladder1$status)
# Add one extra day for the two patients with start=stop=0
# subset(bladder1, stop <= start)
bladder1[bladder1$id == 1, "stop"] <- 1
bladder1[bladder1$id == 49, "stop"] <- 1
# Restrict the data to placebo and thiotepa
bladdersub <- subset(bladder1, treatment %in% c("placebo", "thiotepa"))
# Make treatment variable two-level factor
bladdersub$Z <- as.factor(ifelse(bladdersub$treatment == "placebo", 0, 1))
levels(bladdersub$Z) <- c("placebo", "thiotepa")
head(bladdersub)
# Pseudo observations
pseudo_bladder_2d <- pseudo.twodim(tstart = bladdersub$start,
tstop = bladdersub$stop,
status = bladdersub$status3,
id = bladdersub$id,
covar_names = "Z",
tk = c(30),
data = bladdersub)
head(pseudo_bladder_2d$outdata)
# GEE fit
fit_bladder_2d <- pseudo.geefit(pseudodata = pseudo_bladder_2d,
covar_names = c("Z"))
fit_bladder_2d