Learn R Programming

longke (version 0.1.0)

KE_bwselection: KE_bwselection

Description

Function used to perform leave-one-subject-out cross validation to select optimal time bandwidth (b_s) and trajectory bandwidth (b_w)

Usage

KE_bwselection(data,bw_time,bw_subj,T1,T2)

Value

A list containing 3 elements

BWSelecStep

Total SSE for each bandwidth combination

optimalBW

A vector containing the optimal time/trajectory bandwidth

RunningTime

Running time of the bandwidth selection

Arguments

data

A long format data matrix containing columns ordered by time, subject ID, response, predictor1, predictor2, ... where the measurement time of the longitudinal data should be discretized

bw_time

A numeric vector that contains the candidate time bandwidths

bw_subj

A numeric vector that contains the candidate trajectory bandwidths

T1

A measurement time domain where the functional predictors are measured within

T2

A measurement time domain where the functional response is of interest to predict

References

Wang S, Kim S, Cho H, Chang W. Nonparametric predictive model for sparse and irregular longitudinal data. (2023+)

Examples

Run this code
t_all = 1:50
T1=c(1,25);T2=c(26,50)
data = datagen(ntotal=350,ntest=50,t_all=t_all,t_split=25,seed=1)
data.sample = data$train
bwsele.toy = KE_bwselection(data=data.sample,
bw_time=c(1,2),bw_subj=c(0.1,0.5),T1=T1,T2=T2)
bwsele.toy$optimalBW

Run the code above in your browser using DataLab