Skip to content

Commit

Permalink
robustify bbdml a tad
Browse files Browse the repository at this point in the history
  • Loading branch information
adw96 committed Nov 7, 2023
1 parent afd5df9 commit d02ac1c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/bbdml.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ bbdml <- function(formula, phi.formula, data,
}
# Check that optimx is installed if method is "BFGS"
if (method == "BFGS") {
packages_available <- utils::installed.packages()
packages_available <- utils::installed.packages()[, "Package"]
if (!("optimx" %in% packages_available || "optimr" %in% packages_available)) {
stop("If you would like to use the 'BFGS' method, please install the `optimx` package.")
}
Expand Down Expand Up @@ -272,8 +272,8 @@ Trying to fit more parameters than sample size. Model cannot be estimated.")
phi.link = phi.link, logpar = TRUE),
silent = TRUE)))); if (inherits(mlout, "try-error")) next
} else if ("optimr" %in% packages_available) {
requireNamespace(optimr)
mlout <- try(optimr(par = theta.init,
# requireNamespace(optimr)
mlout <- try(optimr::optimr(par = theta.init,
fn = dbetabin_neg,
gr = gr_full,
method = method,
Expand Down

0 comments on commit d02ac1c

Please sign in to comment.