R/TimeEffects.R
convertToTimeVaryingCoef.Rd
convertToTimeVaryingCoef
convert short sparse covariate table to long sparse covariate table for time-varying coefficients.
convertToTimeVaryingCoef(shortCov, longOut, timeVaryCoefId)
A data frame containing the covariate with predefined columns (see below).
A data frame containing the outcomes with predefined columns (see below), output of splitTime
.
Integer: A numeric identifier of a time-varying coefficient
A long sparse covariate table for time-varying coefficients.
These columns are expected in the shortCov object:
rowId | (integer) | Row ID is used to link multiple covariates (x) to a single outcome (y) |
covariateId | (integer) | A numeric identifier of a covariate |
covariateValue | (real) | The value of the specified covariate |
These columns are expected in the longOut object:
stratumId | (integer) | Stratum ID for time-varying models |
subjectId | (integer) | Subject ID is used to link multiple covariates (x) at different time intervals to a single subject |
rowId | (integer) | Row ID is used to link multiple covariates (x) to a single outcome (y) |
y | (real) | The outcome variable |
time | (real) | For models that use time (e.g. Poisson or Cox regression) this contains time |
(e.g. number of days) |