Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nlmixr package - saem and nlme function issue #421

Closed
thomasjsln opened this issue Oct 16, 2020 · 11 comments
Closed

nlmixr package - saem and nlme function issue #421

thomasjsln opened this issue Oct 16, 2020 · 11 comments

Comments

@thomasjsln
Copy link

Hi,

I have installed the nlmixr package. However when i try to run a code based on the package, i receive error on saem.

Also, i tested the package installation using the file provided by the nlmixr package developer. "https://raw.githubusercontent.com/nlmixrdevelopment/nlmixr/master/build/test_install.R".

When i source the above file, i receive the below error:

source("test_install.R")
Correct R version: Yes, R version 3.6.0 (2019-04-26)
RxODE installed: Yes
Python installed: Yes, Python 3.6.8
sympy installed: Yes
devtools package installed: Yes
RxODE package installed: Yes
Rtools installed or not needed: Yes
SnakeCharmR package installed: Yes
units package installed: Yes
nlmixr package installed: Yes
xpose.nlmixr package installed: Yes
shinyMixR package installed: Yes
Running nlme
Running saem
Error : Error building SAEM model

Could you please let me know what is the exact issue and how could i resolve it?

Best Regards,
Thomas

@thomasjsln
Copy link
Author

Hi,

Adding up to the above issue, when we try to run our code we see the following error:

fit<-nlmixr(M,nmo,est="saem")
Compiling RxODE equations...done.
Building SAEM model...error
Error building SAEM model
── stdout output ─────────────────────────────────────────────────────────────────────────
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -I/usr/local/include -I/home/user/R/x86_64-redhat-linux-gnu-library/3.6/nlmixr//include -I/home/user/R/x86_64-redhat-linux-gnu-library/3.6/StanHeaders//include -I/home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include -I/usr/lib64/R/library/RcppArmadillo//include -I/usr/lib64/R/library/RcppEigen//include -I/usr/lib64/R/library/BH//include -I/home/user/R/x86_64-redhat-linux-gnu-library/3.6/RxODE//include -fpic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -c saemd07aeb61c9933a150e0d61a6603d428a.cpp -o saemd07aeb61c9933a150e0d61a6603d428a.o

── stderr output ─────────────────────────────────────────────────────────────────────────
In file included from saemd07aeb61c9933a150e0d61a6603d428a.cpp:5:0:
/home/user/R/x86_64-redhat-linux-gnu-library/3.6/nlmixr//include/saem_class_rcpp.hpp: In member function ‘void SAEM::saem_fit()’:
/home/user/R/x86_64-redhat-linux-gnu-library/3.6/nlmixr//include/saem_class_rcpp.hpp:493:26: error: call of overloaded ‘isnan(double&)’ is ambiguous
if (isnan(sigma2[b])) sigma2[b] = 1.0e99;
^
/home/user/R/x86_64-redhat-linux-gnu-library/3.6/nlmixr//include/saem_class_rcpp.hpp:493:26: note: candidates are:
In file included from /usr/include/features.h:375:0,
from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/os_defines.h:39,
from /usr/include/c++/4.8.2/x86_64-redhat-linux/bits/c++config.h:2097,
from /usr/include/c++/4.8.2/cmath:41,
from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/Rcpp/platform/compiler.h:100,
from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/Rcpp/r/headers.h:67,
from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/RcppCommon.h:29,
from /usr/lib64/R/library/RcppArmadillo//include/RcppArmadilloForward.h:26,
from /usr/lib64/R/library/RcppArmadillo//include/RcppArmadillo.h:31,
from saemd07aeb61c9933a150e0d61a6603d428a.cpp:3:
/usr/include/bits/mathcalls.h:235:1: note: int isnan(double)
__MATHDECL_1 (int,isnan,, (Mdouble __value)) attribute ((const));
^
In file included from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/Rcpp/platform/compiler.h:100:0,
from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/Rcpp/r/headers.h:67,
from /home/user/R/x86_64-redhat-linux-gnu-library/3.6/Rcpp//include/RcppCommon.h:29,
from /usr/lib64/R/library/RcppArmadillo//include/RcppArmadilloForward.h:26,
from /usr/lib64/R/library/RcppArmadillo//include/RcppArmadillo.h:31,
from saemd07aeb61c9933a150e0d61a6603d428a.cpp:3:
/usr/include/c++/4.8.2/cmath:626:3: note: constexpr bool std::isnan(long double)
isnan(long double __x)
^
/usr/include/c++/4.8.2/cmath:622:3: note: constexpr bool std::isnan(double)
isnan(double __x)
^
/usr/include/c++/4.8.2/cmath:618:3: note: constexpr bool std::isnan(float)
isnan(float __x)
^
saemd07aeb61c9933a150e0d61a6603d428a.cpp: In function ‘arma::vec user_function(const mat&, const mat&, const List&)’:
saemd07aeb61c9933a150e0d61a6603d428a.cpp:57:7: warning: unused variable ‘_cores’ [-Wunused-variable]
int _cores = 1;//_op->cores;
^
make: *** [saemd07aeb61c9933a150e0d61a6603d428a.o] Error 1

Error: Error building SAEM model

I guess this would help you out. Please let me know if you need any more information.

Best Regards,
Thomas

@mattfidler
Copy link
Contributor

Can you try this:

library(nlmixr)
one.compartment <- function() {
  ini({
    tka <- 0.45 # Log Ka
    tcl <- 1 # Log Cl
    tv <- 3.45    # Log V
    eta.ka ~ 0.6
    eta.cl ~ 0.3
    eta.v ~ 0.1
    add.sd <- 0.7
  })
  model({
    ka <- exp(tka + eta.ka)
    cl <- exp(tcl + eta.cl)
    v <- exp(tv + eta.v)
    d/dt(depot) = -ka * depot
    d/dt(center) = ka * depot - cl / v * center
    cp = center / v
    cp ~ add(add.sd)
  })
}
fit2 <- nlmixr(one.compartment, theo_sd, est="saem", control=list(print=0))

It could say what is going wrong.

@thomasjsln
Copy link
Author

Hi Matt,

Thanks for your kind response.

I receive the same error what i posted few minutes earlier.

Thanks,
Thomas

@mattfidler
Copy link
Contributor

Hm. For some reason our messages crossed.

It seems like a platform problem. In your compiler isnan is not recognized and it should be std::isnan. I have fixed it on the developent version of nlmixr, which we plan on releasing after testing.

If you wish you can still run models in focei, or I can give you instructions on how to install the development version.

mattfidler added a commit that referenced this issue Oct 16, 2020
@thomasjsln
Copy link
Author

That's awesome!

Let me try running the models using focei, however it would be very much appreciated if you could share the procedure on installing the development version of nlmixr package.

Thanks,
Thomas

Best Regards,
Thomas

@mattfidler
Copy link
Contributor

The instructions are here;

nlmixrdevelopment/RxODE#170 (comment)

@thomasjsln
Copy link
Author

Hi Matt,

Thank you very much for sharing the information.

I have installed all the prerequisites and the necessary packages as per the procedure. When i try to run my code and yours i face the following error.

Issue:
"Error in deparse1(substitute(x)) : could not find function "deparse1""

 Could you please let me know how to overcome this?

Best Regards,
Thomas

@mattfidler
Copy link
Contributor

Probably

library(backports)

Would fix this. I will have to add a deparse1 in the relavant places.

@mattfidler
Copy link
Contributor

or simply use r 4.0

mattfidler added a commit to nlmixrdevelopment/RxODE that referenced this issue Oct 17, 2020
mattfidler added a commit that referenced this issue Oct 17, 2020
@thomasjsln
Copy link
Author

Hi Matt,

Thank you very much!

The library(backports) actually worked. Now i am able to run my code without any error.
Thanks for resolving the issue quickly. Also i am counting on the release date of this version.

@mattfidler
Copy link
Contributor

Thanks. I'm hoping to release soon.

mattfidler added a commit that referenced this issue Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants