tstartfun | R Documentation |
Function to compute starting time for intervals of follow-up, when using the counting process notation. Within each unit under observation (usually individuals), computes starting time equal to:
time of previous record when there is a previous record.
-1 for first record.
tstartfun(id, timevar, data)
id |
numerical vector, uniquely identifying the units under observation, within which the longitudinal measurements are taken. |
timevar |
numerical vector, representing follow-up time, starting at 0. |
data |
dataframe containing |
Numerical vector containing starting time for each record. In the same order as the records in data
, to facilitate merging.
Currently, id
and timevar
should not contain missing values.
Willem M. van der Wal willem@vanderwalresearch.com, Ronald B. Geskus rgeskus@oucru.org
Van der Wal W.M. & Geskus R.B. (2011). ipw: An R Package for Inverse Probability Weighting. Journal of Statistical Software, 43(13), 1-23. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.18637/jss.v043.i13")}.
basdat
, haartdat
, ipwplot
, ipwpoint
, ipwtm
, timedat
, tstartfun
.
#data
mydata1 <- data.frame(
patient = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2),
time.days = c(14, 34, 41, 56, 72, 98, 0, 11, 28, 35))
#compute starting time for each interval
mydata1$tstart <- tstartfun(patient, time.days, mydata1)
#result
mydata1
#see also ?ipwtm for example
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.