https://github.com/cran/fields
Tip revision: 7b2778b4ea77eab24528cc59cedaba09e3460fa7 authored by Doug Nychka on 22 April 2008, 00:00:00 UTC
version 4.3
version 4.3
Tip revision: 7b2778b
Krig.fs2hat.r
# fields, Tools for spatial data
# Copyright 2004-2007, Institute for Mathematics Applied Geosciences
# University Corporation for Atmospheric Research
# Licensed under the GPL -- www.gpl.org/licenses/gpl.html
"Krig.fs2hat" <-
function(lam, obj)
{
lD <- obj$matrices$D * lam
RSS <- obj$pure.ss + sum(((obj$matrices$u * lD)/(1 + lD))^2)
# print(RSS)
# trA <- sum(1/(1 + lD)) + obj$offset
den <- obj$N - (sum(1/(1 + lD)) + obj$offset)
if(den < 0) {
return(NA)
}
else {
RSS/(den)
}
}