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'

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

 *** caught segfault ***

Traceback:

Traceback:
address 0x110, cause 'invalid permissions'

 *** caught segfault ***
 1: address 0x110, cause 'invalid permissions'
mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
 1:  2: eval_f(x0, ...)
 3: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)
 2: nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,     mi = mi, opts = mi$options)
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]])
 *** caught segfault ***
 4: address 0x110, cause 'invalid permissions'

 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({doTryCatch(return(expr), name, parentenv, handler)
 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])    model <- mi$model    result <- NULL    tryCatch({        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,             mi = mi, opts = mi$options)
 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:     }, 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]], ...)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
10: lapply(X = S, FUN = FUN, ...)
11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])        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)
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: 
Traceback:

doTryCatch(return(expr), name, parentenv, handler) 1: mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)

14: tryCatch(expr, error = function(e) {    call <- conditionCall(e)13:  2: eval_f(x0, ...)
tryCatchList(expr, classes, parentenv, handlers)
14: tryCatch(expr, error = function(e) {    call <- conditionCall(e) 3:  5: tryCatchOne(expr, names, parentenv, handlers[[1L]])
Traceback:
    if (!is.null(call)) {
 6: tryCatchList(expr, classes, parentenv, handlers)
 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,  1:         mi = mi, opts = mi$options)mi$logitFuncs$getMnlV(pars, d$X, d$scalePar)    mi = mi, opts = mi$options)    if (!is.null(call)) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L)        dcall <- deparse(call, nlines = 1L)        prefix <- paste("Error in", dcall, ": ")
}, error = function(e) {        if (identical(call[[1L]], quote(doTryCatch)))             call <- sys.call(-4L) 4: })
 8: system.time({        LONG <- 75L        dcall <- deparse(call, nlines = 1L)        sm <- strsplit(conditionMessage(e), "\n")[[1L]]        prefix <- paste("Error in", dcall, ": ")        LONG <- 75L    model <- mi$modeldoTryCatch(return(expr), name, parentenv, handler)        w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")
    result <- NULL
        if (is.na(w))  2:         sm <- strsplit(conditionMessage(e), "\n")[[1L]]            w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L],     tryCatch({ 5:         w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w")        if (is.na(w))             w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], eval_f(x0, ...)tryCatchOne(expr, names, parentenv, handlers[[1L]])

        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,  3:  6: nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, tryCatchList(expr, classes, parentenv, handlers)            mi = mi, opts = mi$options)                type = "b")                type = "b")    }, error = function(e) {
    mi = mi, opts = mi$options)    }) 7:     if (!is.null(result)) {        model$fail <- FALSE        model$coefficients <- result$solution        model$logLik <- as.numeric(-1 * result$objective)        model$iterations <- result$iterations
 4:         if (w > LONG)             prefix <- paste0(prefix, "\n  ")doTryCatch(return(expr), name, parentenv, handler)tryCatch({        model$status <- result$status    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, 
    }        mi = mi, opts = mi$options) 5: tryCatchOne(expr, names, parentenv, handlers[[1L]])        model$message <- result$message        if (w > LONG) 
    else prefix <- "Error : "    msg <- paste0(prefix, conditionMessage(e), "\n")            prefix <- paste0(prefix, "\n  ")}, error = function(e) { 6:     .Internal(seterrmessage(msg[1L]))tryCatchList(expr, classes, parentenv, handlers)
    if (!silent && isTRUE(getOption("show.error.messages"))) {    }})
}) 7: tryCatch({    result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective,         mi = mi, opts = mi$options)
    }}, error = function(e) { 9: FUN(X[[i]], ...)
10:  8:         cat(msg, file = outFile)})        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))})
15: lapply(X = S, FUN = FUN, ...)try(lapply(X = S, FUN = FUN, ...), silent = TRUE)
16: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))system.time({

17: FUN(X[[i]], ...)
18: lapply(seq_len(cores), inner.do)
    model <- mi$model
19: 11: doTryCatch(return(expr), name, parentenv, handler)
12: tryCatchOne(expr, names, parentenv, handlers[[1L]])
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:  8: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList,     runModel, mc.cores = numCores)))system.time({    else prefix <- "Error : "    result <- NULL
    msg <- paste0(prefix, conditionMessage(e), "\n")    .Internal(seterrmessage(msg[1L]))    if (!silent && isTRUE(getOption("show.error.messages"))) {        cat(msg, file = outFile)        .Internal(printDeferredWarnings())    }13:     invisible(structure(msg, class = "try-error", condition = e))})    model <- mi$model24:     result <- NULL    tryCatch({        result <- nloptr::nloptr(x0 = mi$model$startVals, eval_f = mi$evalFuncs$objective, runMultistart(modelInputs)
tryCatchList(expr, classes, parentenv, handlers)            mi = mi, opts = mi$options)    }, error = function(e) {    })    if (!is.null(result)) {

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

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)
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))15: 
22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))
23: suppressMessages(suppressWarnings(parallel::mclapply(miList, 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)    runModel, mc.cores = numCores)))
24: runMultistart(modelInputs)
25: logitr(data = yogurt, outcome = "choice", obsID = "obsID", pars = c("feat",     "brand"), scalePar = "price", numMultiStarts = 5)        .Internal(printDeferredWarnings())    }    invisible(structure(msg, class = "try-error", condition = e))
})An irrecoverable exception occurred. R is aborting now ...

19: parallel::mclapply(miList, runModel, mc.cores = numCores)
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: 
20: withCallingHandlers(expr, warning = function(w) if (inherits(w,     classes)) tryInvokeRestart("muffleWarning"))
21: 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))
22: withCallingHandlers(expr, message = function(c) if (inherits(c,     classes)) tryInvokeRestart("muffleMessage"))

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: 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 ...
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