enhance.grid | R Documentation |
enhance.grid
enhances the sandwich smoother by
choosing a optimal penalty value to lower the GCV
statistic. A grid search algorithm is utilized based on
the each row of par
. The penalty values (assumed
to be on the log scale) are passed to the
loglambda2gcv
function. If prepare
is TRUE
, then obj
is returned with the
penalty values that minimize the GCV statistic during the
grid search. Otherwise, the complete results of the grid
search are returned.
enhance.grid(obj, par, prepare = TRUE, loggcv = FALSE, ..., cl = NULL)
obj |
A |
par |
A matrix-like object (i.e.,
|
prepare |
A logical value. The default is |
loggcv |
A logical value indicating whether the log
of the GCV statistic should be used. Useful for very large
data sets. Default is |
... |
Additional arguments to pass to to the
|
cl |
A cluster object created by |
By default, a prepared_*
object with the
optimal loglambda
values that minimize the GCV,
along with an additional component, results
,
that contains the optimization results. Otherwise, the
complete results of the grid search.
Joshua French
# create b-splines
b1 = bspline(nbasis = 10)
b2 = bspline(nbasis = 12)
# observed data locations
x1 = seq(0, 1, len = 60)
x2 = seq(0, 1, len = 80)
# construct "true" data
mu = matrix(0, nrow = 60, ncol = 80)
for(i in seq_len(60)) {
for(j in seq_len(80)) {
mu[i, j] = sin(2*pi*(x1[i]-.5)^3)*cos(4*pi*x2[j])
}
}
# construct noisy data
data = mu + rnorm(60 * 80)
obj = prepare(data, list(x1, x2), list(b1, b2))
enhance.grid(obj, prepare = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.