Learn R Programming

HQM (version 0.1.1)

b_selection: Cross validation bandwidth selection

Description

Implements the bandwidth selection for the future conditional hazard rate \(\hat h_x(t)\) based on K-fold cross validation.

Usage

b_selection(data, marker_name, event_time_name = 'years',
            time_name = 'year', event_name = 'status2', I, b_list)

Value

A list with the tested bandwidths and its cross validation scores.

Arguments

data

A data frame of time dependent data points. Missing values are allowed.

marker_name

The column name of the marker values in the data frame data.

event_time_name

The column name of the event times in the data frame data.

time_name

The column name of the times the marker values were observed in the data frame data.

event_name

The column name of the events in the data frame data.

I

Number of observations leave out for a K cross validation.

b_list

Vector of bandwidths that need to be tested.

Details

The function b_selection implements the cross validation bandwidth selection for the future conditional hazard rate \(\hat h_x(t)\) given by $$ b_{CV} = arg min_b \sum_{i = 1}^N \int_0^T \int_s^T Z_i(t)Z_i(s)(\hat{h}_{X_i(s)}(t-s)- h_{X_i(s)}(t-s))^2 dt ds,$$ where \(\hat h_x(t)\) is a smoothed kernel density estimator of \( h_x(t)\) and \(Z_i\) the exposure process of individual \(i\). Note that \(\hat h_x(t)\) is dependent on \(b\).

See Also

b_selection_prep_g, Q1, R_K, prep_cv, dataset_split

Examples

Run this code
# \donttest{
I = 26
b_list = seq(0.9, 1.3, 0.1)

b_scores_alb = b_selection(pbc2, 'albumin', 'years', 'year', 'status2', I, b_list)
b_scores_alb[[2]][which.min(b_scores_alb[[1]])]# }

Run the code above in your browser using DataLab