Put communals in "fixed" data frame
Given an ordinary data frame suitable for survival analysis, and a data frame with "communal" time series, this function includes the communal covariates as fixed, by the "cutting spells" method.
make.communal( dat, com.dat, communal = TRUE, start, period = 1, lag = 0, surv = c("enter", "exit", "event", "birthdate"), tol = 1e-04, fortran = TRUE )
dat |
A data frame containing interval specified survival data and covariates, of which one must give a "birth date", the connection between duration and calendar time |
com.dat |
Data frame with communal covariates. They must have the same
start year and periodicity, given by |
communal |
Boolean; if TRUE, then it is a true communal (default),
otherwise a fixed. The first component is the first year (start date in
decimal form), and the second component is the period length. The third is
|
start |
Start date in decimal form. |
period |
Period length. Defaults to one. |
lag |
The lag of the effect. Defaults to zero. |
surv |
Character vector of length 4 giving the names of interval start,
interval end, event indicator, birth date, in that order. These names must
correspond to names in |
tol |
Largest length of an interval considered to be of zero length. The cutting sometimes produces zero length intervals, which we want to discard. |
fortran |
If |
The return value is a data frame with the same variables as in the
combination of dat
and com.dat
. Therefore it is an error to
have common name(s) in the two data frames.
Not very vigorously tested.
Göran Broström
dat <- data.frame(enter = 0, exit = 5.731, event = 1, birthdate = 1962.505, x = 2) ## Birth date: July 2, 1962 (approximately). com.dat <- data.frame(price = c(12, 3, -5, 6, -8, -9, 1, 7)) dat.com <- make.communal(dat, com.dat, start = 1962.000)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.