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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: turbo
> ### Title: Methods for objects of class "turbo"
> ### Aliases: turbo print.turbo pars pars.turbo error error.turbo plot.turbo
> ###   grad grad.turbo hessian hessian.turbo stderror stderror.turbo
> 
> ### ** Examples
> 
> ###########################################################################
> # Also see the vignette by typing:
> #  vignette("turboEM")
> #
> # EM algorithm for Poisson mixture estimation 
> 
> fixptfn <- function(p,y) {
+ # The fixed point mapping giving a single E and M step of the EM algorithm
+ # 
+ pnew <- rep(NA,3)
+ i <- 0:(length(y)-1)
+ zi <- p[1]*exp(-p[2])*p[2]^i / (p[1]*exp(-p[2])*p[2]^i + (1 - p[1])*exp(-p[3])*p[3]^i)
+ pnew[1] <- sum(y*zi)/sum(y)
+ pnew[2] <- sum(y*i*zi)/sum(y*zi)
+ pnew[3] <- sum(y*i*(1-zi))/sum(y*(1-zi))
+ p <- pnew
+ return(pnew)
+ }
> 
> objfn <- function(p,y) {
+ # Objective function whose local minimum is a fixed point 
+ # negative log-likelihood of binary poisson mixture
+ i <- 0:(length(y)-1)
+ loglik <- y*log(p[1]*exp(-p[2])*p[2]^i/exp(lgamma(i+1)) + 
+ 		(1 - p[1])*exp(-p[3])*p[3]^i/exp(lgamma(i+1)))
+ return ( -sum(loglik) )
+ }
> 
> # Real data from Hasselblad (JASA 1969)
> poissmix.dat <- data.frame(death=0:9, freq=c(162,267,271,185,111,61,27,8,3,1))
> y <- poissmix.dat$freq
> 
> # Use a preset seed so the example is reproducable. 
> require("setRNG")
Loading required package: setRNG
> old.seed <- setRNG(list(kind="Mersenne-Twister", normal.kind="Inversion",
+     seed=1))
> 
> p0 <- c(runif(1),runif(2,0,4))  # random starting value
> 
> # Basic EM algorithm, SQUAREM, and parabolic EM, with default settings
> res1 <- turboem(par=p0, y=y, fixptfn=fixptfn, objfn=objfn, method=c("EM", "squarem", "pem"))
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
turboEM
 --- call from context --- 
turboem(par = p0, y = y, fixptfn = fixptfn, objfn = objfn, method = c("EM", 
    "squarem", "pem"))
 --- call from argument --- 
if (class(control.method) != "list") stop("'control.method' must be of class 'list'")
 --- R stacktrace ---
where 1: turboem(par = p0, y = y, fixptfn = fixptfn, objfn = objfn, method = c("EM", 
    "squarem", "pem"))

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (par, fixptfn, objfn = NULL, method = c("em", "squarem", 
    "pem", "decme", "qn"), boundary = NULL, pconstr = NULL, project = NULL, 
    parallel = FALSE, ..., control.method = replicate(length(method), 
        list()), control.run = list()) 
{
    method <- tolower(method)
    method <- match.arg(method, several.ok = TRUE)
    if (class(control.method) != "list") 
        stop("'control.method' must be of class 'list'")
    if (length(method) == 1 & class(control.method[[1]]) != "list") 
        control.method <- list(control.method)
    if (length(control.method) != length(method)) 
        stop("The number of components of 'control.method' must be equal to the number of methods being compared")
    for (j in seq_along(method)) if (class(control.method[[j]]) != 
        "list") 
        stop("each component of 'control.method' must be of class 'list'")
    if (missing(objfn)) 
        objfn <- NULL
    control.run.default <- list(convtype = "parameter", tol = 1e-07, 
        stoptype = "maxiter", maxiter = 1500, maxtime = 60, convfn.user = NULL, 
        stopfn.user = NULL, trace = FALSE, keep.objfval = FALSE)
    namc <- names(control.run)
    if (!all(namc %in% names(control.run.default))) {
        stop("unknown names in control.run: ", namc[!(namc %in% 
            names(control.run.default))])
    }
    control.run <- modifyList(control.run.default, control.run)
    pars <- matrix(NA, length(method), length(par))
    rownames(pars) <- method
    objfeval <- fpeval <- itr <- value.objfn <- vector("numeric", 
        length(method))
    convergence <- fail <- vector("logical", length(method))
    errors <- vector("character", length(method))
    runtime <- matrix(NA, length(method), 3)
    colnames(runtime) <- c("user", "system", "elapsed")
    if (!control.run$keep.objfval) {
        trace.objfval <- NULL
    }
    else {
        trace.objfval <- vector("list", length(method))
    }
    if (parallel) {
        resall <- foreach(j = seq_along(method), .packages = "turboEM", 
            .errorhandling = "pass") %dopar% accelerate(par = par, 
            fixptfn = fixptfn, objfn = objfn, boundary = boundary, 
            method = method[j], pconstr = pconstr, project = project, 
            ..., control = modifyList(control.run, control.method[[j]]))
    }
    else {
        resall <- foreach(j = seq_along(method), .packages = "turboEM", 
            .errorhandling = "pass") %do% accelerate(par = par, 
            fixptfn = fixptfn, objfn = objfn, boundary = boundary, 
            method = method[j], pconstr = pconstr, project = project, 
            ..., control = modifyList(control.run, control.method[[j]]))
    }
    for (j in seq_along(method)) {
        if (control.run$trace) 
            cat(paste("Method ", j, ":  \n", sep = ""))
        res <- resall[[j]]
        if (!"turboem" %in% class(res)) {
            fail[j] <- TRUE
            errors[j] <- as.character(res)
            pars[j, ] <- NA
            itr[j] <- NA
            fpeval[j] <- NA
            objfeval[j] <- NA
            value.objfn[j] <- NA
            convergence[j] <- NA
            if (control.run$keep.objfval) {
                trace.objfval[[j]] <- NA
            }
        }
        else {
            errors[j] <- NA
            pars[j, ] <- res$par
            itr[j] <- res$itr
            fpeval[j] <- res$fpeval
            objfeval[j] <- res$objfeval
            value.objfn[j] <- res$value.objfn
            convergence[j] <- res$convergence
            runtime[j, ] <- round(res$runtime[1:3], 3)
            if (control.run$keep.objfval) {
                trace.objfval[[j]] <- res$trace.objfval
            }
            control.method[[j]] <- res$control
        }
    }
    lst <- list(...)
    arg.names <- names(lst)
    if (is.null(objfn)) {
        obfjn.return <- NULL
    }
    else {
        obfjn.return <- objfn
        formals(obfjn.return)[arg.names] <- lst
    }
    formals(fixptfn)[arg.names] <- lst
    if (!is.null(pconstr)) {
        sel <- names(formals(pconstr))[names(formals(pconstr)) %in% 
            arg.names]
        formals(pconstr)[sel] <- lst[sel]
    }
    ret <- list(fail = fail, value.objfn = value.objfn, itr = itr, 
        fpeval = fpeval, objfeval = objfeval, convergence = convergence, 
        runtime = runtime, errors = errors, pars = pars, method = method, 
        trace.objfval = trace.objfval, control.method = control.method, 
        control.run = control.run, fixptfn = fixptfn, objfn = obfjn.return, 
        pconstr = pconstr, project = project)
    class(ret) <- "turbo"
    return(ret)
}
<bytecode: 0x556e6c7292b0>
<environment: namespace:turboEM>
 --- function search by body ---
Function turboem in namespace turboEM has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(control.method) != "list") stop("'control.method' must be of class 'list'") : 
  the condition has length > 1
Calls: turboem
Execution halted