loglambda2gcv {hero}R Documentation

Determine GCV statistic

Description

loglambda2gcv uses a vector of penalty values to evaluate the GCV statistic for a prepared_response object.

Usage

loglambda2gcv(loglambda, obj, loggcv = FALSE)

Arguments

loglambda

A vector of penalty values (assumed to be on a natural logarithmic scale) for computing the GCV.

obj

A prepared_* object from a prepare function.

loggcv

A logical value indicating whether the log of the GCV statistic should be returned. The default is FALSE.

Details

Though this function can be used by the user, it is basically an internal function used to find the value of loglambda minimizing the GCV statistic.

Value

The scalar GCV statistic

See Also

prepare

Examples

n1 = 10
b1 = bspline(nbasis = 10)
x1 = seq(0, 1, len = n1)
n2 = 20
x2 = seq(0, 1, len = n2)
b2 = bspline(nbasis = 12)
# construct "true" data
mu = matrix(0, nrow = n1, ncol = n2)
for(i in seq_len(n1)) {
   for(j in seq_len(n2)) {
      mu[i, j] =  sin(2*pi*(x1[i]-.5)^3)*cos(4*pi*x2[j])
   }
}
image(mu)
# construct noisy data
data = mu + rnorm(n1 * n2)
x = list(x1, x2)
splines = list(b1, b2)
obj = prepare(data, x, splines)
loglambda2gcv(c(0, 0), obj)

[Package hero version 0.6 Index]