Errors in running code in vignettes:
when running code in 'laGP.Rnw'

> library("laGP")

> library("MASS")

> library("lhs")

> library("akima")

> library("tgp")

> options(prompt = "R> ", width = 65)

> set.seed(1)

> X <- matrix(seq(0, 2 * pi, length = 6), ncol = 1)

> Z <- sin(X)

> gp <- newGP(X, Z, 2, 1e-06, dK = TRUE)

> mleGP(gp, tmax = 20)
$d
[1] 4.386202

$its
[1] 6


> XX <- matrix(seq(-1, 2 * pi + 1, length = 499), ncol = ncol(X))

> p <- predGP(gp, XX)

> deleteGP(gp)

> library("mvtnorm")

> N <- 100

> ZZ <- rmvt(N, p$Sigma, p$df)

> ZZ <- ZZ + t(matrix(rep(p$mean, N), ncol = N))

> matplot(XX, t(ZZ), col = "gray", lwd = 0.5, lty = 1, 
+     type = "l", bty = "n", main = "simple sinusoidal example", 
+     xlab = "x", ylab = "Y( ..." ... [TRUNCATED] 

> points(X, Z, pch = 19)

> x <- seq(-2, 2, by = 0.02)

> X <- as.matrix(expand.grid(x, x))

> N <- nrow(X)

> f2d <- function(x) {
+     g <- function(z) return(exp(-(z - 1)^2) + exp(-0.8 * (z + 
+         1)^2) - 0.05 * sin(8 * (z + 0.1)))
+     -g(x[, 1])  .... [TRUNCATED] 

> Y <- f2d(X)

> Xref <- matrix(c(-1.725, 1.725), nrow = 1)

> p.mspe <- laGP(Xref, 6, 50, X, Y, d = 0.1, method = "mspe")

> p.alc <- laGP(Xref, 6, 50, X, Y, d = 0.1, method = "alc")

> Xi <- rbind(X[p.mspe$Xi, ], X[p.alc$Xi, ])

> plot(X[p.mspe$Xi, ], xlab = "x1", ylab = "x2", type = "n", 
+     main = "comparing local designs", xlim = range(Xi[, 1]), 
+     ylim = range(Xi[,  .... [TRUNCATED] 

> text(X[p.mspe$Xi, ], labels = 1:length(p.mspe$Xi), 
+     cex = 0.7)

> text(X[p.alc$Xi, ], labels = 1:length(p.alc$Xi), cex = 0.7, 
+     col = 2)

> points(Xref[1], Xref[2], pch = 19, col = 3)

> legend("topright", c("mspe", "alc"), text.col = c(1, 
+     2), bty = "n")

> p <- rbind(c(p.mspe$mean, p.mspe$s2, p.mspe$df), c(p.alc$mean, 
+     p.alc$s2, p.alc$df))

> colnames(p) <- c("mean", "s2", "df")

> rownames(p) <- c("mspe", "alc")

> p
           mean           s2 df
mspe -0.3725312 2.518566e-06 50
alc  -0.3724820 2.445077e-06 50

> p.mspe$mle
          d dits
1 0.3588186    7

> p.alc$mle
          d dits
1 0.3378369    7

> c(p.mspe$time, p.alc$time)
elapsed elapsed 
   0.61    0.19 

> xx <- seq(-1.97, 1.95, by = 0.04)

> XX <- as.matrix(expand.grid(xx, xx))

> YY <- f2d(XX)

> nth <- as.numeric(Sys.getenv("OMP_NUM_THREADS"))

> if (is.na(nth)) nth <- 2

> print(nth)
[1] 2

> P.alc <- aGP(X, Y, XX, omp.threads = nth, verb = 0)

> persp(xx, xx, -matrix(P.alc$mean, ncol = length(xx)), 
+     phi = 45, theta = 45, main = "", xlab = "x1", ylab = "x2", 
+     zlab = "yhat(x)")

> med <- 0.51

> zs <- XX[, 2] == med

> sv <- sqrt(P.alc$var[zs])

> r <- range(c(-P.alc$mean[zs] + 2 * sv, -P.alc$mean[zs] - 
+     2 * sv))

> plot(XX[zs, 1], -P.alc$mean[zs], type = "l", lwd = 2, 
+     ylim = r, xlab = "x1", ylab = "predicted & true response", 
+     bty = "n", main = "sl ..." ... [TRUNCATED] 

> lines(XX[zs, 1], -P.alc$mean[zs] + 2 * sv, col = 2, 
+     lty = 2, lwd = 2)

> lines(XX[zs, 1], -P.alc$mean[zs] - 2 * sv, col = 2, 
+     lty = 2, lwd = 2)

> lines(XX[zs, 1], YY[zs], col = 3, lwd = 2, lty = 3)

> diff <- P.alc$mean - YY

> plot(XX[zs, 1], diff[zs], type = "l", lwd = 2, main = "systematic bias in prediction", 
+     xlab = "x1", ylab = "y(x) - yhat(x)", bty = "n")

> plot(XX[zs, 1], P.alc$mle$d[zs], type = "l", lwd = 2, 
+     main = "spatially varying lengthscale", xlab = "x1", ylab = "thetahat(x)", 
+     bty = .... [TRUNCATED] 

> df <- data.frame(y = log(P.alc$mle$d), XX)

> lo <- loess(y ~ ., data = df, span = 0.01)

> lines(XX[zs, 1], exp(lo$fitted)[zs], col = 2, lty = 2, 
+     lwd = 2)

> legend("topright", "loess smoothed", col = 2, lty = 2, 
+     lwd = 2, bty = "n")

> P.alc2 <- aGP(X, Y, XX, d = exp(lo$fitted), omp.threads = nth, 
+     verb = 0)

> rmse <- data.frame(alc = sqrt(mean((P.alc$mean - YY)^2)), 
+     alc2 = sqrt(mean((P.alc2$mean - YY)^2)))

> rmse
           alc         alc2
1 0.0006227472 0.0003024842

> p.alcray <- laGP(Xref, 6, 50, X, Y, d = 0.1, method = "alcray")

> plot(X[p.alc$Xi, ], xlab = "x1", ylab = "x2", type = "n", 
+     main = "comparing local designs", xlim = range(Xi[, 1]), 
+     ylim = range(Xi[, 2 .... [TRUNCATED] 

> text(X[p.alc$Xi, ], labels = 1:length(p.alc$Xi), cex = 0.7, 
+     col = 2)

> text(X[p.alcray$Xi, ], labels = 1:length(p.mspe$Xi), 
+     cex = 0.7, col = 3)

> points(Xref[1], Xref[2], pch = 19, col = 3)

> legend("topright", c("alc", "alcray"), text.col = c(2, 
+     3), bty = "n")

> p.alcray$time
elapsed 
   0.04 

> p <- rbind(p, c(p.alcray$mean, p.alcray$s2, p.alcray$df))

> rownames(p)[3] <- c("alcray")

> p
             mean           s2 df
mspe   -0.3725312 2.518566e-06 50
alc    -0.3724820 2.445077e-06 50
alcray -0.3723245 1.840875e-06 50

> P.alcray <- aGP(X, Y, XX, method = "alcray", omp.threads = nth, 
+     verb = 0)

> dfray <- data.frame(y = log(P.alcray$mle$d), XX)

> loray <- loess(y ~ ., data = dfray, span = 0.01)

> P.alcray2 <- aGP(X, Y, XX, method = "alcray", d = exp(loray$fitted), 
+     omp.threads = nth, verb = 0)

> c(P.alcray$time, P.alcray2$time)
elapsed elapsed 
 159.61  127.60 

> rmse <- cbind(rmse, data.frame(alcray = sqrt(mean((P.alcray$mean - 
+     YY)^2)), alcray2 = sqrt(mean((P.alcray2$mean - YY)^2))))

> rmse
           alc         alc2       alcray      alcray2
1 0.0006227472 0.0003024842 0.0004415616 0.0002102268

> borehole <- function(x) {
+     rw <- x[1] * (0.15 - 0.05) + 0.05
+     r <- x[2] * (50000 - 100) + 100
+     Tu <- x[3] * (115600 - 63070) + 63070
 .... [TRUNCATED] 

> N <- 1e+05

> Npred <- 1000

> dim <- 8

> library("lhs")

> T <- 10

> nas <- rep(NA, T)

> times <- rmse <- data.frame(mspe = nas, mspe2 = nas, 
+     alc.nomle = nas, alc = nas, alc2 = nas, nn.nomle = nas, nn = nas, 
+     big.nn.nomle =  .... [TRUNCATED] 

> for (t in 1:T) {
+     x <- randomLHS(N + Npred, dim)
+     y <- apply(x, 1, borehole)
+     ypred.0 <- y[-(1:N)]
+     y <- y[1:N]
+     xpred <- x .... [TRUNCATED] 

... incomplete output.  Crash?

  'laGP.Rnw'... failed to complete the test