R_K {HQM} | R Documentation |
Bandwidth selection score R
Description
Calculates a part for the K-fold cross validation score.
Usage
R_K(h_xt_mat_list, int_X, size_X_grid, Yi, Ni, n)
Arguments
h_xt_mat_list |
A list of matrices for all cross validation data sets. Each matrix contains the estimator with the future conditional hazard rate for all values |
int_X |
Vector of the position of the observed marker values in the grid for marker values. |
size_X_grid |
Numeric value indicating the number of grid points for marker values. |
Yi |
A matrix made by |
Ni |
A matrix made by |
n |
Number of individuals. |
Details
The function implements the estimator
where and
is estimated without information from all counting processes
with
.
This function estimates
where is the hqm estimator,
the exposure and
the marker.
Value
A matrix with for all individuals
i
and time grid points t
.
See Also
Examples
pbc2_id = to_id(pbc2)
n = max(as.numeric(pbc2$id))
b = 1.5
I = 104
h_xt_mat_list = prep_cv(pbc2, pbc2_id, 'serBilir', 'years', 'year', 'status2', n, I, b)
size_s_grid <- size_X_grid <- 100
s = pbc2$year
X = pbc2$serBilir
br_s = seq(0, max(s), max(s)/( size_s_grid-1))
br_X = seq(min(X), max(X), (max(X)-min(X))/( size_X_grid-1))
ss <- pbc2_id$years
delta <- pbc2_id$status2
X_lin = lin_interpolate(br_s, pbc2_id$id, pbc2$id, X, s)
int_X <- findInterval(X_lin, br_X)
int_s = rep(1:length(br_s), n)
Yi <- make_Yi(pbc2, pbc2_id, X_lin, br_X, br_s,
size_s_grid, size_X_grid, int_s, int_X, 'years', n)
Ni <- make_Ni(br_s, size_s_grid, ss, delta, n)
R = R_K(h_xt_mat_list, int_X, size_X_grid, Yi, Ni, n)
R