Description Usage Arguments Value See Also Examples
This function calculates generalized cross-validation for ridge regression.
1 | gcv.lambda(obs, latlon, netlab, eta, approx=FALSE, lambda)
|
obs |
observations |
latlon |
grid points of observation sites in degree |
netlab |
vector of labels representing sub-networks |
eta |
bandwidth parameters for Poisson kernel |
approx |
if TRUE, approximation is used. |
lambda |
smoothing parameter for penalized least squares method |
gcv |
generalized cross-validation for ridge regression. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ### Observations of year 1967
data(temperature)
names(temperature)
# Temperatures on 939 weather stations of year 1967
temp67 <- temperature$obs[temperature$year == 1967]
# Locations of 939 weather stations
latlon <- temperature$latlon[temperature$year == 1967, ]
### Network design by BUD
data(netlab)
### Bandwidth for Poisson kernel
eta <- c(0.961, 0.923, 0.852, 0.723, 0.506)
### Select smoothing parameter lambda by generalized cross-validation
lam <- seq(0.1, 0.9, ,9)
gcv <- NULL
for(i in 1:length(lam))
gcv <- c(gcv, gcv.lambda(obs=temp67, latlon=latlon,
netlab=netlab, eta=eta, lambda=lam[i])$gcv)
lam[gcv == min(gcv)]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.