gcv_cov {mlrv}R Documentation

Generalized Cross Validation

Description

Given a bandwidth, compute its corresponding GCV value

Usage

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

Arguments

bw

double, bandwidth

t

vector, scaled time \([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 \[n^{-1}| Y-\hat{Y}|^2/[1- \mathrm{tr}(Q(b)) / n]^2\] When computing \(\mathrm{tr}(Q(b))\), we use the fact that the first derivative of coefficient function is zero at central point The ith diagonal value of \(Q(b)\) is actually \(x^T(t_i)S^{-1}_{n}x(t_i)\) where \(S^{-1}_{n}\) means the top left p-dimension square matrix of \(S_{n}(t_i) = X^T W(t_i) X\), \(W(t_i)\) is the kernel weighted matrix. Details on the computation of \(S_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)

[Package mlrv version 0.1.2 Index]