'Issue with bbmle package and optimx in R returning par as all NAs
I am having an issue with using the optimx with the bbmle package. The model will run on my personal computer, but will not return viable results on a linux computer. Both are running the same code, on R version 4.1.3 and optimx package version 2021.10.12 and bbmle package version 1.0.24. I can run the NLL function on both computers and do not think it is an issue with the function itself. I have thus not included reproducible code as the NLL fxn works on my machine, additionally the NLL is not a simple model and the data is a large list. Below is my code for the mle runs:
require(bbmle)
require(optimx)
MLE.test <- mle2(minuslogl = nll,
start = log_start, #list of starting values for NLL arguments
fixed = list(cv_q = 0.5), # one argument from NLL that is fixed
data = list(dat = dat1, #list of data for NLL
scale = 1), # argument value set to a scale of 1
optimizer = "optimx",
method = "bobyqa",
lower = low, #vector of lower bounds
upper = upp, #vector of upper bounds
control=list(maxit=2000, trace=5), skip.hessian = TRUE)
The results on my Mac look like this
coef(MLE.test)
hypox_a hypox_b fi cv_q sigma_p rec1 rec2 rec3 rec4
3.4512339 1.7724387 -1.5397089 0.5000000 -1.9490732 1.3548618 -0.1552055 1.3323955 1.1739773
Log-likelihood: -9496.14
The results on the Linux computer look like this
coef(MLE.test)
hypox_a hypox_b fi cv_q sigma_p rec1 rec2 rec3 rec4
NA NA NA 0.5 NA NA NA NA NA
Log-likelihood: -8.988466e+307
I ran the MLE model with the "all.methods = T" approach to see if it was an error with loading the optimx package on the Linux machine, and the model ran until it reached the "bobyqa" method where it terminated. The trace arguement returns this at the start of the model run with the "bobyqa" method
$have.bounds
[1] TRUE
$method
[1] "bobyqa"
Method: bobyqa
bobyqa failed for current problem
Post processing for method bobyqa
Save results from method bobyqa
$fevals
[1] NA
$value
[1] 8.988466e+307
$par
[1] NA NA NA NA NA NA NA NA
I then set up a text file in the NLL fxn to print parameters as they are being tested and this is what the Linux machine returns as updates. It eventually settles on the final line with all NAs and a NLL of 0.
Start time: 2022-04-12 10:13:07
// hypox_a= 4 / hypox_b= 1 / fi= -0.22314355131421 / sigma= -2.30258509299405 / NLL= 15171.9421911981
Start time: 2022-04-12 10:13:07
// hypox_a= NA / hypox_b= NA / fi= NA / sigma= NA / NLL= 0
Start time: 2022-04-12 10:13:07
// hypox_a= NA / hypox_b= NA / fi= NA / sigma= NA NLL= 0
Does anyone have suggestions for where this may have gone wrong or if there are compatibility issues with Linux machines?
Solution 1:[1]
installed the 'minqa' package which resolved the issue of NAs in place of the parameters and gave viable results with MLE2.
install.packages("minqa")
require(minqa)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Monty |
