You are here:
Vanderbilt Biostatistics Wiki
>
Main Web
>
TWikiUsers
>
AlexZhao
>
AlexFun
(21 Aug 2013,
AlexZhao
)
(raw view)
E
dit
A
ttach
---+ My R Functions %TOC% ---++ 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 easy. *Arguments:* *x:* a list of dataframe, each dataframe contains only 3 columns, 1) patient id; 2) time when covariate changes; 3) value that the covariate changes to *y:* a dataframe that contains patient id, survival time, last follow up status and other non-time-varying 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 that will be kept, default is all variables in "y" *Call:* <highlight> 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")) </highlight> ---++ Generate a results table (as a data frame) for a given fitted model. The data frame can work with xtable package nicely to generate tex code for the final PDF file. This set of functions will work with most available fitted models (objects of class) , including but not limited to aov, coxph, glm, lm, loess, manova, mlm, nls, glm, Glm, lrm, ols, cph, nlme. The main function will return a table (data frame) that has all (or selected) predictors and/or linear combinations in rows. It will contain columns: Variable name, Estimates, s.e., OR/HR, CI, p values. Users can easily choose the columns that they want to present by working with the data frame. %TABLE{ sort="on" tableborder="1" cellpadding="10" cellspacing="0" valign="top" headercolor="#ffffff" headerbg="#687684" headerbgsorted="#334455" databg="#ffffff,#edf4f9" databgsorted="#f1f7fc,#ddebf6" tablerules="rows"}% | *Variable* | *Estimate* | *s.e.* | *OR or HR* | *95% CI* | *p* | | Predictor 1 | 0.53 | 0.12 | 1.20 | (1.11, 3.50) | <0.001 | | Predictor 2 | 1.58 | 0.86 | 2.60 | (1.11, 3.50) | 0.03 | | Predictor 3 | 2.58 | 0.35 | 3.84 | (1.11, 3.50) | 0.005 | | Linear combination 1 | 3.57 | 0.42 | 2.13 | (1.11, 3.50) | 0.80 | | Linear combination 2 | 2.89 | 1.02 | 3.52 | (1.11, 3.50) | 0.25 | This set of functions are currently under development. Please come back soon. If you have any suggestions or comments, please drop me a message at alex.zhao@vanderbilt.edu. <!-- __Personal Preferences (details in %TWIKIWEB%.TWikiVariables)__ * Vertical size of text edit box: * Set EDITBOXHEIGHT = 25 * Optionally write protect your home page: (set it to your %TWIKIWEB%.WikiName) * Release Edit Default * Set RELEASEEDITLOCKCHECKBOX = checked="checked" * How to respond to attachments * Set ATTACHLINKBOX = checked="checked" * Set HIDEFILE = checked="checked" * Set ATTACHEDFILELINKFORMAT = \n * [[%ATTACHURL%/$name][$name]] * Check Minor Changes Box * Set DONTNOTIFYCHECKBOX = unchecked="unchecked" * Allow Jump auto completion from any IP address * Set JUMPAUTOCOMPLETE = 1 __Related topics__ * %TWIKIWEB%.%WIKIPREFSTOPIC% has site-level preferences of %WIKITOOLNAME%. * %WEBPREFSTOPIC% has preferences of the %WIKITOOLNAME%.%WEB% web. * %MAINWEB%.%WIKIUSERSTOPIC% has a list of other TWiki users. --> * [[%ATTACHURL%/mergeI.R][mergeI.R]] * [[%ATTACHURL%/data.RData][data.RData]] * [[%ATTACHURL%/mergeI.R][mergeI.R]]
Attachments
1
Attachments
1
Topic attachments
I
Attachment
Action
Size
Date
Who
Comment
R
mergeI.R
manage
5.4 K
21 Aug 2013 - 10:20
AlexZhao
E
dit
|
A
ttach
|
P
rint version
|
H
istory
: r7
<
r6
<
r5
<
r4
|
B
acklinks
|
V
iew topic
|
Edit
w
iki text
|
M
ore topic actions
Topic revision: r7 - 21 Aug 2013,
AlexZhao
Main
Department Home Page
Biostatistics Graduate Program
Vanderbilt University Medical Center
Main Web
Main Web Home
Search
Recent Changes
Changes
Topic list
Biostatistics Webs
Archive
Main
Sandbox
System
Register
|
Log In
Copyright © 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