gcv_cov: Generalized Cross Validation

View source: R/RcppExports.R

gcv_covR Documentation

Generalized Cross Validation

Description

Given a bandwidth, compute its corresponding GCV value \loadmathjax

Usage

gcv_cov(bw, t, y, X, verbose = 1L)

Arguments

bw

double, bandwidth

t

vector, scaled time \mjseqn[0,1]

y

vector, response

X

matrix, covariates matrix

verbose

bool, whether to print the numerator and denominator in GCV value

Details

Generalized cross validation value is defined as \mjsdeqnn^-1| Y-\hatY|^2/[1- \mathrmtr(Q(b)) / n]^2 When computing \mjseqn\mathrmtr(Q(b)), we use the fact that the first derivative of coefficient function is zero at central point The ith diagonal value of \mjseqnQ(b) is actually \mjseqnx^T(t_i)S^-1_nx(t_i) where \mjseqnS^-1_n means the top left p-dimension square matrix of \mjseqnS_n(t_i) = X^T W(t_i) X, \mjseqnW(t_i) is the kernel weighted matrix. Details on the computation of \mjseqnS_n could be found in LocLinear and its reference

Value

GCV value

Examples

param = list(d = -0.2, heter = 2, tvd = 0,
 tw = 0.8, rate = 0.1, cur = 1, center = 0.3,
  ma_rate =  0, cov_tw =  0.2, cov_rate = 0.1,
   cov_center = 0.1, all_tw  = 1, cov_trend = 0.7)
data = Qct_reg(1000, param)
value <- gcv_cov(0.2, (1:1000)/1000, data$y, data$x)

mlrv documentation built on Sept. 11, 2024, 6:57 p.m.