Running examples in ‘SpatioTemporal-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: loglikeST
> ### Title: Compute the Log-likelihood for the Spatio-Temporal Model
> ### Aliases: loglikeST loglikeSTnaive
> 
> ### ** Examples
> 
> ##load the data
> data(mesa.model)
> 
> ##Compute dimensions for the data structure
> dim <- loglikeSTdim(mesa.model)
> 
> ##Find out in which order parameters should be given
> loglikeST(NULL, mesa.model)
 [1] "log.range.const.exp"           "log.sill.const.exp"           
 [3] "log.range.V1.exp"              "log.sill.V1.exp"              
 [5] "log.range.V2.exp"              "log.sill.V2.exp"              
 [7] "nu.log.range.exp"              "nu.log.sill.exp"              
 [9] "nu.log.nugget.(Intercept).exp" "nu.log.nugget.typeFIXED.exp"  
> 
> ##Let's create random vectors of values
> x <- runif( dim$nparam.cov )
> x.all <- runif( dim$nparam )
> 
> ##Evaluate the log-likelihood for these values
> loglikeST(x.all, mesa.model, "f")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
SpatioTemporal
 --- call from context --- 
loglikeST(x.all, mesa.model, "f")
 --- call from argument --- 
if (class(sigma.B) == "try-error") {
    return(-.Machine$double.xmax)
}
 --- R stacktrace ---
where 1: loglikeST(x.all, mesa.model, "f")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x = NULL, STmodel, type = "p", x.fixed = NULL) 
{
    stCheckClass(STmodel, "STmodel", name = "STmodel")
    type <- tolower(type)
    x <- stCheckLoglikeIn(x, x.fixed, type)
    if (is.null(x) || any(is.na(x))) {
        return(loglikeSTnames(STmodel, all = (type == "f")))
    }
    dimensions <- loglikeSTdim(STmodel)
    if ((type == "f" && length(x) != dimensions$nparam) || (type != 
        "f" && length(x) != dimensions$nparam.cov)) {
        stop("Number of parameters, length(x), incorrect.")
    }
    tmp <- loglikeSTgetPars(x, STmodel)
    if (type == "f") {
        gamma <- tmp$gamma
        alpha <- tmp$alpha
    }
    cov.pars.beta <- tmp$cov.beta
    cov.pars.nu <- tmp$cov.nu
    Y <- STmodel$obs$obs
    F <- expandF(STmodel$F, STmodel$obs$idx, n.loc = dimensions$n.obs)
    if (type == "f") {
        mu.B <- matrix(calc.mu.B(STmodel$LUR, alpha), ncol = 1)
        if (dimensions$L != 0) {
            Y <- Y - STmodel$ST %*% gamma
        }
    }
    sigma.B <- makeSigmaB(cov.pars.beta$pars, dist = STmodel$D.beta, 
        type = STmodel$cov.beta$covf, nugget = cov.pars.beta$nugget)
    sigma.nu <- makeSigmaNu(cov.pars.nu$pars, dist = STmodel$D.nu, 
        type = STmodel$cov.nu$covf, nugget = cov.pars.nu$nugget, 
        random.effect = cov.pars.nu$random.effect, blocks1 = STmodel$nt, 
        ind1 = STmodel$obs$idx, sparse = TRUE)
    sigma.B <- try(makeCholBlock(sigma.B, n.blocks = dimensions$m), 
        silent = TRUE)
    if (class(sigma.B) == "try-error") {
        return(-.Machine$double.xmax)
    }
    sigma.nu <- try(chol(sigma.nu), silent = TRUE)
    if (class(sigma.nu) == "try-error") {
        return(-.Machine$double.xmax)
    }
    l <- -sumLogDiag(sigma.B)
    l <- l - sumLog(diag(sigma.nu))
    sigma.B <- invCholBlock(sigma.B, n.blocks = dimensions$m)
    sigma.nu <- chol2inv(sigma.nu)
    i.sR.Y <- as.matrix(sigma.nu %*% Y)
    if (type == "f") {
        i.sB.mu.B <- blockMult(sigma.B, mu.B, n.blocks = dimensions$m)
        l <- l - dotProd(i.sB.mu.B, mu.B)/2
        l <- l - dotProd(i.sR.Y, Y)/2
    }
    else {
        iS.X <- calc.iS.X(STmodel$LUR, sigma.B)
        if (dimensions$L != 0) {
            i.sR.M <- as.matrix(sigma.nu %*% STmodel$ST)
        }
        F.i.sR.Y <- calc.tFX(STmodel$F, i.sR.Y, STmodel$obs$idx, 
            n.loc = dimensions$n.obs)
        if (dimensions$L != 0) {
            F.i.sR.M <- calc.tFX(STmodel$F, i.sR.M, STmodel$obs$idx, 
                n.loc = dimensions$n.obs)
        }
    }
    sigma.B.Y <- as.matrix(t(F) %*% sigma.nu %*% F) + sigma.B
    sigma.B.Y <- try(chol(sigma.B.Y), silent = TRUE)
    if (class(sigma.B.Y) == "try-error") {
        return(-.Machine$double.xmax)
    }
    l <- l - sumLogDiag(sigma.B.Y)
    if (type == "f") {
        mu.B.Y <- i.sB.mu.B + calc.tFX(STmodel$F, i.sR.Y, STmodel$obs$idx, 
            n.loc = dimensions$n.obs)
        mu.B.Y <- solveTriBlock(sigma.B.Y, mu.B.Y, transpose = TRUE)
        l <- l + norm2(mu.B.Y)/2
    }
    else {
        Y.hat <- solveTriBlock(sigma.B.Y, F.i.sR.Y, transpose = TRUE)
        if (dimensions$L != 0) {
            M.hat <- solveTriBlock(sigma.B.Y, F.i.sR.M, transpose = TRUE)
        }
        sigma.B.Y <- invCholBlock(sigma.B.Y)
        sigma.B.Y.iS.X <- sigma.B.Y %*% iS.X
        i.sigma.alpha.Y <- -t(iS.X) %*% sigma.B.Y.iS.X + calc.X.iS.X(STmodel$LUR, 
            iS.X)
        i.sigma.alpha.Y <- try(chol(i.sigma.alpha.Y), silent = TRUE)
        if (class(i.sigma.alpha.Y) == "try-error") {
            return(-.Machine$double.xmax)
        }
        if (type == "r") {
            l <- l - sumLogDiag(i.sigma.alpha.Y)
        }
        Y.hat.2 <- t(sigma.B.Y.iS.X) %*% F.i.sR.Y
        Y.hat.2 <- solveTriBlock(i.sigma.alpha.Y, Y.hat.2, transpose = TRUE)
        Y.sigma.hat.Y <- dotProd(Y, i.sR.Y) - norm2(Y.hat) - 
            norm2(Y.hat.2)
        l <- l - Y.sigma.hat.Y/2
        if (dimensions$L != 0) {
            M.hat.2 <- t(sigma.B.Y.iS.X) %*% F.i.sR.M
            M.hat.2 <- solveTriBlock(i.sigma.alpha.Y, M.hat.2, 
                transpose = TRUE)
            Y.sigma.hat.M <- (t(Y) %*% i.sR.M - t(Y.hat) %*% 
                M.hat - t(Y.hat.2) %*% M.hat.2)
            Y.sigma.hat.M <- t(Y.sigma.hat.M)
            M.sigma.hat.M <- (t(STmodel$ST) %*% i.sR.M - t(M.hat) %*% 
                M.hat - t(M.hat.2) %*% M.hat.2)
            M.sigma.hat.M <- try(chol(M.sigma.hat.M), silent = TRUE)
            if (class(M.sigma.hat.M) == "try-error") {
                return(-.Machine$double.xmax)
            }
            if (type == "r") {
                l <- l - sumLogDiag(M.sigma.hat.M)
            }
            Y.sigma.hat.M <- solveTriBlock(M.sigma.hat.M, Y.sigma.hat.M, 
                transpose = TRUE)
            l <- l + norm2(Y.sigma.hat.M)/2
        }
    }
    l <- as.double(l)
    if (!is.finite(l)) 
        l <- -.Machine$double.xmax
    return(l)
}
<bytecode: 0x55b70ce13820>
<environment: namespace:SpatioTemporal>
 --- function search by body ---
Function loglikeST in namespace SpatioTemporal has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(sigma.B) == "try-error") { : 
  the condition has length > 1
Calls: loglikeST
Execution halted