View source: R/pseudo.threedim.R
pseudo.threedim | R Documentation |
This function computes 3-dimensional pseudo-observations of the marginal mean function (in the presence of terminal events) and cumulative incidences of death causes 1 and 2
pseudo.threedim(tstart, tstop, status, covar_names, id, tk, data, deathtype)
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 |
deathtype |
Type of death (cause 1 or cause 2) |
An object of class pseudo.threedim
.
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)).
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
# 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) # Add deathtype variable to bladder data # Deathtype = 1 (bladder disease death), deathtype = 2 (other death reason) bladdersub$deathtype <- with(bladdersub, ifelse(status == 2, 1, ifelse(status == 3, 2, 0))) table(bladdersub$deathtype, bladdersub$status) # Pseudo-observations pseudo_bladder_3d <- pseudo.threedim(tstart = bladdersub$start, tstop = bladdersub$stop, status = bladdersub$status3, id = bladdersub$id, deathtype = bladdersub$deathtype, covar_names = "Z", tk = c(30), data = bladdersub) pseudo_bladder_3d # GEE fit fit_bladder_3d <- pseudo.geefit(pseudodata = pseudo_bladder_3d, covar_names = c("Z")) fit_bladder_3d
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.