R/spanCV.R

Defines functions loessGCV

### Modified from code by ucfagls http://www.r-bloggers.com/whats-wrong-with-loess-for-palaeo-data/
loessGCV <- function(x) {
    if (!(inherits(x, "loess"))) 
        stop("Error: argument must be a loess object")
    span <- x$pars$span
    n <- x$n
    traceL <- x$trace.hat
    sigma2 <- sum(resid(x)^2)/(n - 1)
    gcv <- n * sigma2/(n - traceL)^2
    result <- list(span = span, gcv = gcv)
    result
}
13479776/statTarget documentation built on Aug. 14, 2020, 1:58 p.m.