demo/pred.R

###################################################
### chunk number 1: 
###################################################
library(tgp)
library(maptree)
##options(width=65)
seed <- 0; set.seed(seed)


###################################################
### chunk number 2: 
###################################################
library(MASS)
out <- btgpllm(X=mcycle[,1], Z=mcycle[,2], bprior="b0", 
	       pred.n=FALSE, verb=0) 
save(out, file="out.Rsave")
out <- NULL


###################################################
### chunk number 3: 
###################################################
load("out.Rsave")
XX <- seq(2.4, 56.7, length=200)
out.kp <- predict(out, XX=XX, pred.n=FALSE)


###################################################
### chunk number 4: 
###################################################
out.p <- predict(out, XX=XX, pred.n=FALSE, BTE=c(0,1000,1))


###################################################
### chunk number 5: 
###################################################
out2 <- predict(out, XX, pred.n=FALSE, BTE=c(0,2000,2),
                krige=FALSE)


###################################################
### chunk number 6: kp
###################################################
plot(out.kp, center="km", as="ks2")


###################################################
### chunk number 7: 
###################################################
rl <- readline("press RETURN to continue: ")
graphics.off()


###################################################
### chunk number 8: p
###################################################
plot(out.p)


###################################################
### chunk number 9: 
###################################################
rl <- readline("press RETURN to continue: ")
graphics.off()


###################################################
### chunk number 10: 2
###################################################
plot(out2)


###################################################
### chunk number 11: 
###################################################
rl <- readline("press RETURN to continue: ")
graphics.off()


###################################################
### chunk number 12: 
###################################################
unlink("out.Rsave")

Try the tgp package in your browser

Any scripts or data that you put into this service are public.

tgp documentation built on Jan. 7, 2023, 1:17 a.m.