View source: R/loglambda2gcv.R
loglambda2gcv | R Documentation |
loglambda2gcv
uses a vector of penalty values
to evaluate the GCV statistic for a
prepared_response
object.
loglambda2gcv(loglambda, obj, loggcv = FALSE)
loglambda |
A vector of penalty values (assumed to be on a natural logarithmic scale) for computing the GCV. |
obj |
A |
loggcv |
A logical value indicating whether the log of the
GCV statistic should be returned.
The default is |
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.
The scalar GCV statistic
prepare
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.