# predict.ddhazard

##### Predict Method for ddhazard Object

Predict method for `ddhazard`

.

##### Usage

```
# S3 method for ddhazard
predict(object, new_data, type = c("response",
"term"), tstart = "start", tstop = "stop", use_parallel, sds = F,
max_threads, ...)
```

##### Arguments

- object
result of a

`ddhazard`

call.- new_data
new data to base predictions on.

- type
either

`"response"`

for predicted probability of an event or`"term"`

for predicted terms in the linear predictor.- tstart
name of the start time column in

`new_data`

. It must be on the same time scale as the`tstart`

used in the`Surv(tstart, tstop, event)`

in the`formula`

passed to`ddhazard`

.- tstop
same as

`tstart`

for the stop argument.- use_parallel
not longer supported.

- sds
`TRUE`

if point wise standard deviation should be computed. Convenient if you use functions like`ns`

and you only want one term per term in the right hand site of the`formula`

used in`ddhazard`

.- max_threads
not longer supported.

- ...
not used.

##### Details

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.

##### Term

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.

##### Response

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`

.

##### Examples

```
# NOT RUN {
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")
# }
```

*Documentation reproduced from package dynamichazard, version 0.6.5, License: GPL-2*