predict.ddhazard | R Documentation |
Predict method for ddhazard
.
## S3 method for class 'ddhazard' predict( object, new_data, type = c("response", "term"), tstart = "start", tstop = "stop", use_parallel, sds = FALSE, max_threads, ... )
object |
result of a |
new_data |
new data to base predictions on. |
type |
either |
tstart |
name of the start time column in |
tstop |
same as |
use_parallel |
not longer supported. |
sds |
|
max_threads |
not longer supported. |
... |
not used. |
The function check if there are columns in new_data
which names match
tstart
and tstop
. If matched, then the bins are found which
the start time to the stop time are in. If tstart
and tstop
are not
matched then all the bins used in the estimation method will be used.
Returns a list with elements as described in the Term and Response sections.
The result with type = "term"
is a lists of list each having length
equal to nrow(new_data)
. The lists are
terms
It's elements are matrices where the first dimension is time and the second dimension is the terms.
sds
similar to terms
for the point-wise confidence
intervals using the smoothed co-variance matrices. Only added if
sds = TRUE
.
fixed_terms
contains the fixed (non-time-varying) effect.
varcov
similar to sds
but differs by containing the whole
covariance matrix for the terms. It is a 3D array where the third dimension is
time. Only added if sds = TRUE
.
start
numeric vector with start time for each time-varying term.
tstop
numeric vector with stop time for each time-varying term.
The result with type = "response"
is a list with the elements below.
If tstart
and tstop
are matched in columns in new_data
,
then the probability will be for having an event between tstart
and tstop
conditional on no events before tstart
.
fits
fitted probability of an event.
istart
numeric vector with start time for each element in fits
.
istop
numeric vector with stop time for each element in fits
.
fit <- ddhazard( Surv(time, status == 2) ~ log(bili), pbc, id = pbc$id, max_T = 3600, Q_0 = diag(1, 2), Q = diag(1e-4, 2), by = 50, control = ddhazard_control(method = "GMA")) predict(fit, type = "response", new_data = data.frame(time = 0, status = 2, bili = 3)) predict(fit, type = "term", new_data = data.frame(time = 0, status = 2, bili = 3)) # probability of an event between time 0 and 2000 with bili = 3 predict(fit, type = "response", new_data = data.frame(time = 0, status = 2, bili = 3, tstart = 0, tstop = 2000), tstart = "tstart", tstop = "tstop")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.