View source: R/standardize.prodlim.R
standardize.prodlim | R Documentation |
Compute standardized absolute risks based on a stratified Kaplan-Meier or Aalen-Johansen estimate
standardize.prodlim(object, var1, var2, times, data, weights, ...)
object |
Object obtained with |
var1 |
Name of one of the two categorical variables. The absolute risks are standardized within the levels of this variables to the distribution of the other categorical variable in the full data. |
var2 |
Name of the other of the two categorical variables, i.e., the one on which the weights are based. |
times |
Compute absolute risks at these time points |
data |
Only if weights are not given. Data set in which to compute the weights for
standardization as percentage in each of the levels of |
weights |
A numeric vector of weights that sum to 1 and has length equal
to the number of strata defined by |
... |
not used |
Fit prodlim with two categorical covariates, say age and sex. Then standardize the absolute risk within each of the two gender to the age distribution in whole data set.
Thomas A. Gerds <tag@biostat.ku.dk>
library(survival)
library(prodlim)
library(data.table)
data(pbc)
d <- na.omit(pbc[,c("time","status","trt","age","sex")])
d$agegroup <- cut(d$age,breaks=c(0,40,50,60,100))
fit <- prodlim(Hist(time,status==1)~trt+agegroup,data=d)
standardize.prodlim(fit,var1="trt",var2="agegroup",data=d,times=1000)
standardize.prodlim(fit,var1="trt",var2="agegroup",data=d,times=c(1000,1500))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.