b_selection_prep_g {HQM} | R Documentation |
Preparations for bandwidth selection
Description
Calculates an intermediate part for the K-fold cross validation.
Usage
b_selection_prep_g(h_mat, int_X, size_X_grid, n, Yi)
Arguments
h_mat |
A matrix of the estimator for 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. |
n |
Number of individuals. |
Yi |
A matrix made by |
Details
The function b_selection_prep_g
calculates a key component for the bandwidth selection
\hat{g}^{-I_j}_i(t) = \int_0^t Z_i(s) \hat{h}^{-I_j}_{X_i(s)}(t-s) ds,
where \hat{h}^{-I_j}
is estimated without information from all counting processes i
with i \in I_j
and Z
is the exposure.
Value
A matrix with \hat{g}^{-I_j}_i(t)
for all individuals i
and time grid points t
.
See Also
Examples
pbc2_id = to_id(pbc2)
size_s_grid <- size_X_grid <- 100
n = max(as.numeric(pbc2$id))
s = pbc2$year
X = pbc2$serBilir
XX = pbc2_id$serBilir
ss <- pbc2_id$years
delta <- pbc2_id$status2
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))
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)
N <- make_N(pbc2, pbc2_id, breaks_X=br_X, breaks_s=br_s, ss, XX, delta)
Y <- make_Y(pbc2, pbc2_id, X_lin, br_X, br_s, size_s_grid, size_X_grid, int_s, int_X, 'years', n)
b = 1.7
alpha<-get_alpha(N, Y, b, br_X, K=Epan )
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(breaks_s=br_s, size_s_grid, ss, delta, n)
t = 2
h_xt_mat = t(sapply(br_s[1:99], function(si){
h_xt_vec(br_X, br_s, size_s_grid, alpha, t, b, Yi, int_X, n)}))
b_selection_prep_g(h_xt_mat, int_X, size_X_grid, n, Yi)
[Package HQM version 0.1.0 Index]