residuals.ddhazard | R Documentation |
Residuals method for the result of a ddhazard
call.
## S3 method for class 'ddhazard' residuals( object, type = c("std_space_error", "space_error", "pearson", "raw"), data = NULL, ... )
object |
result of |
type |
type of residuals. Four possible values: |
data |
|
... |
not used. |
Returns a list as described in the Pearson and raw residuals section and in the State space errors section.
Is the result of a call with a type
argument of either "pearson"
or "raw"
for Pearson residuals or raw residuals. Returns a list with class "ddhazard_residual"
with the following elements.
residuals
list of residuals for each bin. Each element of the list contains a 2D array where the rows corresponds to the passed data
and columns are the residuals (residuals
), estimated probability of death (p_est
), outcome (Y
) and row number in the initial data set (row_num
). The data
rows will only have a residuals in a given risk list if they are at risk in that risk set.
type
the type of residual.
Is the result of a call with a type
argument of either "std_space_error"
or "space_error"
. The former is for standardized residuals while the latter is non-standardized. Returns a list with class. "ddhazard_space_errors"
with the following elements:
residuals
2D array with either standardized or non-standardized state space errors. The row are bins and the columns are the parameters in the regression.
standardize
TRUE
if standardized state space errors.
Covariances
3D array with the smoothed co-variance matrix for each set of the state space errors.
library(dynamichazard) 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")) resids <- residuals(fit, type = "pearson")$residuals head(resids[[1]]) head(resids[[2]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.