| prep_cv {HQM} | R Documentation | 
Prepare for Cross validation bandwidth selection
Description
Implements the calculation of the hqm estimator on cross validation data sets. This is a preparation for the cross validation bandwidth selection technique for future conditional hazard rate estimation based on marker information data.
Usage
prep_cv(data, data.id, marker_name, event_time_name = 'years',
        time_name = 'year',event_name = 'status2', n, I, b)
Arguments
| data | A data frame of time dependent data points. Missing values are allowed. | 
| data.id | An id data frame obtained from  | 
| marker_name | The column name of the marker values in the data frame  | 
| event_time_name | The column name of the event times in the data frame  | 
| time_name | The column name of the times the marker values were observed in the data frame  | 
| event_name | The column name of the events in the data frame  | 
| n | Number of individuals. | 
| I | Number of observations leave out for a K cross validation. | 
| b | Bandwidth. | 
Details
The function splits the data set via dataset_split and calculates for every splitted data set the hqm estimator
\hat{h}_x(t) = \frac{\sum_{i=1}^n \int_0^T\hat{\alpha}_i(X_i(t+s))Z_i(t+s)Z_i(s)K_{b}(x-X_i(s))\mathrm {d}s}{\sum_{i=1}^n\int_0^TZ_i(t+s)Z_i(s)K_{b}(x-X_i(s))\mathrm {d}s},
for all x on the marker grid and t on the time grid, where X is the marker, Z is the exposure and \alpha(z) is the marker-only hazard, see get_alpha for more details.
Value
A list of matrices for every cross validation data set with \hat{h}_x(t) for all x on the marker grid and t on the time grid.
See Also
Examples
pbc2_id = to_id(pbc2)
n = max(as.numeric(pbc2$id))
b = 1.5
I = 26
h_xt_mat_list = prep_cv(pbc2, pbc2_id, 'serBilir', 'years', 'year', 'status2', n, I, b)