#
Tps( ChicagoO3$x, ChicagoO3$y)-> obj # default is to find lambda by GCV
summary( obj)
KrigFindLambda( obj)-> out
print( out$lambda.est) # results agree with Tps summary
sreg( rat.diet$t, rat.diet$trt)-> out
gcv.sreg( out, tol=1e-10) # higher tolerance search for minimum
if (FALSE) {
# a simulation example
x<- seq( 0,1,,150)
f<- x**2*( 1-x)
f<- f/sqrt( var( f))
set.seed(123) # let's all use the same seed
tau<- .1
y<- f + rnorm( 150)*tau
Tps( x,y)-> obj # create Krig object
hold<- hold2<- matrix( NA, ncol=6, nrow=200)
for( k in 1:200){
# look at GCV estimates of lambda
# new data simulated
y<- f + rnorm(150)*tau
# save GCV estimates
lambdaTable<- KrigFindLambda(obj, y=y, give.warnings=FALSE)$lambda.est
hold[k,]<- lambdaTable[1,]
hold2[k,]<- lambdaTable[6,]
}
matplot( cbind(hold[,2], hold2[,2]),cbind( hold[,4],hold2[,4]),
xlab="estimated eff. df", ylab="tau hat", pch=16, col=c("orange3", "green2"), type="p")
yline( tau, col="grey", lwd=2)
}
Run the code above in your browser using DataLab