My R Functions

Create time intervals data for time-varying covariates in survival analysis

When several time-varying covariates present in survival analysis, creating the dataset with time intervals is no longer as straightforward as it was when only single time-varying covariate was involved. This set of functions (in R) were wrote for the purpose of making this type of data manipulation easier.

Arguments:

x: a list of dataframe, each dataframe includes contains only 3 columns, patient id, time when covariate changs, value that the covariate changes to

y: a dataframe that contains patient id, survival time, last follow up status and other non-timevaring covariates

by.id: variable name for patient id in all datasets

by.time: variable name for time in all datasets

var.status: variable name for last follow up status

var.baseline: varaible names for all other non-timevarying covariates

Call:

require(Hmisc)

source("http://biostat.mc.vanderbilt.edu/wiki/pub/Main/AlexFun/mergeI.R")

load(url("http://biostat.mc.vanderbilt.edu/wiki/pub/Main/AlexFun/data.RData"))

mergeI(x=list(d1,d2,d3), y=d0, by.id="pid", by.time="time", var.status="status", var.baseline=c("gender","race"))

Edit | Attach | Print version | History: r7 | r6 < r5 < r4 < r3 | Backlinks | View wiki text | Edit WikiText | More topic actions...
Topic revision: r5 - 21 Oct 2010, AlexZhao
 

This site is powered by FoswikiCopyright © 2013-2022 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Vanderbilt Biostatistics Wiki? Send feedback