cvscoremv: Calculate the CV score for determining regularisation...

Description Usage Arguments Value Author(s) References See Also Examples

Description

Evaluates the cross-validation criterion of Hazelton and Turlach (2009) for the bivariate case.

Usage

1
cv.score.mv(y, Sigma, H, gamma, K=5, verb=FALSE)

Arguments

y

matrix with two columns containing the observed values.

Sigma

the variance-covariance matrix of the contaminating (normal) distribution.

H

the matrix of smoothing parameter to be used.

gamma

vector of values from which a suitable value is to be selected

K

number of folds to be used if gamma is chosen by cross-validation; defaults to 5.

verb

logical; if TRUE some progress report will be printed during cross-validation.

Value

A vector containing the cross-validation criterion evaluated at the values given in gamma.

Author(s)

Martin L Hazelton m.hazelton@massey.ac.nz

References

Hazelton, M.L. and Turlach, B.A. (2009). Nonparametric density deconvolution by weighted kernel estimators, Statistics and Computing 19(3): 217–228. http://dx.doi.org/10.1007/s11222-008-9086-7.

See Also

w.hat.mv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  library(ks)
  Age <- framingham[,2]
  Age.lim.2 <- 56
  SBP1.A <- framingham[Age>=Age.lim.2,3] # SBP, measure 1, Exam 2 
  SBP2.A <- framingham[Age>=Age.lim.2,4] # SBP, measure 2, Exam 2 
  SBP1.B <- framingham[Age>=Age.lim.2,5] # SBP, measure 1, Exam 3 
  SBP2.B <- framingham[Age>=Age.lim.2,6] # SBP, measure 2, Exam 3 
  sigma.fram.A <- sd(SBP1.A-SBP2.A)
  sigma.fram.B <- sd(SBP1.B-SBP2.B)
  Sigma.fram <- diag(c(sigma.fram.A,sigma.fram.B))^2
  SBP.A <- SBP1.A
  SBP.B <- SBP1.B
  SBP.bi <- cbind(SBP.A,SBP.B)
  H.fram <- Hpi(SBP.bi)

  gamma.ridge <- exp(seq(from=-2, to=3, length=17))

  set.seed(100813)
  cv <- cv.score.mv(SBP.bi, Sigma=Sigma.fram, H=H.fram,
                    gamma=gamma.ridge, verb=TRUE)
  plot(log(gamma.ridge), cv, type="b")
  tmp <- getmin(log(gamma.ridge), cv, which="r")
  abline(v=tmp$xmin)

  set.seed(100813)
  cv <- cv.score.mv(SBP.bi, Sigma=Sigma.fram, H=H.fram,
                    gamma=gamma.ridge, verb=TRUE, K=10)
  plot(log(gamma.ridge), cv, type="b")
  tmp <- getmin(log(gamma.ridge), cv, which="r")
  abline(v=tmp$xmin)

DeconWK documentation built on May 2, 2019, 6:08 p.m.