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

> ### Name: logitr
> ### Title: The main function for estimating logit models
> ### Aliases: logitr
> ### Keywords: logit logitr mixed mnl mxl willingness-to-pay wtp
> 
> ### ** Examples
> 
> # For more detailed examples, visit
> # https://jhelvy.github.io/logitr/articles/
> 
> library(logitr)
> 
> # Estimate a MNL model in the Preference space
> mnl_pref <- logitr(
+   data    = yogurt,
+   outcome = "choice",
+   obsID   = "obsID",
+   pars    = c("price", "feat", "brand")
+ )
Running model...
Done!
> 
> # Estimate a MNL model in the WTP space, using a 5-run multistart
> mnl_wtp <- logitr(
+   data           = yogurt,
+   outcome        = "choice",
+   obsID          = "obsID",
+   pars           = c("feat", "brand"),
+   scalePar       = "price",
+   numMultiStarts = 5
+ )
Running multistart...
  Random starting point iterations: 5
  Number of cores: 15

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

Traceback:
 1: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
 2: eval_f(x0, ...)
 3: nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,     mi = mi, opts = mi$options)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         mi = mi, opts = mi$options)}, error = function(e) {})
 8: system.time({    model <- mi$model    result <- NULL    tryCatch({        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,             mi = mi, opts = mi$options)    }, error = function(e) {    })    if (!is.null(result)) {        model$fail <- FALSE        model$coefficients <- result$solution        model$logLik <- as.numeric(-1 * result$objective)        model$iterations <- result$iterations        model$status <- result$status        model$message <- result$message    }})
 9: FUN(X[[i]], ...)
10: lapply(X = S, FUN = FUN, ...)
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
15: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
17: FUN(X[[i]], ...)
18: lapply(seq_len(cores), inner.do)
19: parallel::mclapply(miList, runModel, mc.cores = numCores)
20: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
21: suppressWarnings(parallel::mclapply(miList, runModel, mc.cores = numCores))
22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList,     runModel, mc.cores = numCores)))
24: runMultistart(modelInputs)
25: logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat",     "brand"), scalePar = "price", numMultiStarts = 5)
An irrecoverable exception occurred. R is aborting now ...

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
address 0x110, cause 'invalid permissions'

Traceback:
 1: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
 2: eval_f(x0, ...)
 3: nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,     mi = mi, opts = mi$options)
 4: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         mi = mi, opts = mi$options)}, error = function(e) {})
 8: system.time({    model <- mi$model    result <- NULL    tryCatch({
Traceback:
 1: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
 2: eval_f(x0, ...)
 3: nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, 
Traceback:
            mi = mi, opts = mi$options)    }, error = function(e) {    mi = mi, opts = mi$options)
Traceback:
    }) 1: 
 1:  4: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
    if (!is.null(result)) {
        model$fail <- FALSE        model$coefficients <- result$solution        model$logLik <- as.numeric(-1 * result$objective)        model$iterations <- result$iterations        model$status <- result$status        model$message <- result$message    }})
 9: FUN(X[[i]], ...)
10: doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 2: 
 2: lapply(X = S, FUN = FUN, ...) 6: 
tryCatchList(expr, classes, parentenv, handlers)eval_f(x0, ...)
 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         mi = mi, opts = mi$options)
}, error = function(e) {eval_f(x0, ...)
 3: 11:  3: })nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,     mi = mi, opts = mi$options)

nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 4: doTryCatch(return(expr), name, parentenv, handler)    mi = mi, opts = mi$options)
13: tryCatchList(expr, classes, parentenv, handlers)

14:  4: 
doTryCatch(return(expr), name, parentenv, handler) 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
tryCatch(expr, error = function(e) { 8:  6: 
tryCatchList(expr, classes, parentenv, handlers)    call <- conditionCall(e)
system.time({ 5:     if (!is.null(call)) { 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, tryCatchOne(expr, names, parentenv, handlers[[1L]])
 6:     model <- mi$model        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))         mi = mi, opts = mi$options)    result <- NULLtryCatchList(expr, classes, parentenv, handlers)
 7:             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], }, error = function(e) {                type = "b")    tryCatch({        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         if (w > LONG) tryCatch({            mi = mi, opts = mi$options)    }, error = function(e) {})            prefix <- paste0(prefix, "\n  ")    }
    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
15:     }) 8:     result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, system.time({try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
17:     if (!is.null(result)) {        model$fail <- FALSE        mi = mi, opts = mi$options)FUN(X[[i]], ...)}, error = function(e) {
18:     model <- mi$model        model$coefficients <- result$solution})        model$logLik <- as.numeric(-1 * result$objective)    result <- NULL    tryCatch({        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,             mi = mi, opts = mi$options)    }, error = function(e) {    })    if (!is.null(result)) {        model$fail <- FALSE        model$iterations <- result$iterations
 8: system.time({    model <- mi$model    result <- NULL    tryCatch({        model$coefficients <- result$solution        model$logLik <- as.numeric(-1 * result$objective)        model$iterations <- result$iterations        model$status <- result$status        model$message <- result$message    }})lapply(seq_len(cores), inner.do)        model$status <- result$status

19:         model$message <- result$message        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,  9:             mi = mi, opts = mi$options)    }, error = function(e) {    }    })parallel::mclapply(miList, runModel, mc.cores = numCores)    if (!is.null(result)) {        model$fail <- FALSE        model$coefficients <- result$solution        model$logLik <- as.numeric(-1 * result$objective)        model$iterations <- result$iterations        model$status <- result$status        model$message <- result$message})
 9:     }FUN(X[[i]], ...)})

10: lapply(X = S, FUN = FUN, ...)
11: doTryCatch(return(expr), name, parentenv, handler)FUN(X[[i]], ...) 9: 
FUN(X[[i]], ...)12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: 
tryCatchList(expr, classes, parentenv, handlers)
20: withCallingHandlers(expr, warning = function(w) if (inherits(w, 
    classes)) tryInvokeRestart("muffleWarning"))
10: lapply(X = S, FUN = FUN, ...)14: 
10: 
11: 21: suppressWarnings(parallel::mclapply(miList, runModel, mc.cores = numCores))
lapply(X = S, FUN = FUN, ...)tryCatch(expr, error = function(e) {22: doTryCatch(return(expr), name, parentenv, handler)    call <- conditionCall(e)
12:     if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch))) tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: 
withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList,     runModel, mc.cores = numCores)))
tryCatchList(expr, classes, parentenv, handlers)24: 
runMultistart(modelInputs)
25:             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat", 14: 11: tryCatch(expr, error = function(e) {    "brand"), scalePar = "price", numMultiStarts = 5)
An irrecoverable exception occurred. R is aborting now ...
doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
13: tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch(expr, error = function(e) {    call <- conditionCall(e)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        LONG <- 75L        if (is.na(w))         sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})    call <- conditionCall(e)
    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 15: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))                type = "b")        if (w > LONG)             prefix <- paste0(prefix, "\n  ")    }    else prefix <- "Error : "        LONG <- 75L        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],                 type = "b")    msg <- paste0(prefix, conditionMessage(e), "\n")        if (w > LONG)     .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
            prefix <- paste0(prefix, "\n  ")
    }17: FUN(X[[i]], ...)
18: lapply(seq_len(cores), inner.do)
19: parallel::mclapply(miList, runModel, mc.cores = numCores)
20: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
    else prefix <- "Error : "15: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
17: 21:     msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))FUN(X[[i]], ...)})
15: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))
18: lapply(seq_len(cores), inner.do)
19: parallel::mclapply(miList, runModel, mc.cores = numCores)
20: 
withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
21: suppressWarnings(parallel::mclapply(miList, runModel, mc.cores = numCores))
22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList,     runModel, mc.cores = numCores)))
24: runMultistart(modelInputs)
25: logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat",     "brand"), scalePar = "price", numMultiStarts = 5)17: FUN(X[[i]], ...)
18: lapply(seq_len(cores), inner.do)
19: parallel::mclapply(miList, runModel, mc.cores = numCores)
20: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))

suppressWarnings(parallel::mclapply(miList, runModel, mc.cores = numCores))An irrecoverable exception occurred. R is aborting now ...

22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList, 21: suppressWarnings(parallel::mclapply(miList, runModel, mc.cores = numCores))
22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList,     runModel, mc.cores = numCores)))
24: runMultistart(modelInputs)
25: logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat",     "brand"), scalePar = "price", numMultiStarts = 5)
An irrecoverable exception occurred. R is aborting now ...
    runModel, mc.cores = numCores)))
24: runMultistart(modelInputs)
25: logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat",     "brand"), scalePar = "price", numMultiStarts = 5)
An irrecoverable exception occurred. R is aborting now ...
Error in names(x) <- value : 
  'names' attribute [3] must be the same length as the vector [0]
Calls: logitr -> getMultistartSummary -> colnames<-
Execution halted