Skip to content

Commit

Permalink
Fix #554
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfidler committed Aug 28, 2021
1 parent d7b9804 commit 49f2091
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

- Give instructions on how to reinstall nlmixr if it is linked to a
different version of `RxODE`. (#555)

- Now inform which parameters are near the boundary (#544)

- The `saem` estimation routine will now increase the tolerance when
ODE solving is difficult; This can be controlled with
Expand Down
18 changes: 10 additions & 8 deletions src/inner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4848,6 +4848,8 @@ NumericMatrix sqrtm(NumericMatrix m){

//[[Rcpp::export]]
NumericMatrix foceiCalcCov(Environment e){
std::string boundStr = "";
CharacterVector thetaNames=as<CharacterVector>(e["thetaNames"]);
try {
if (op_focei.covMethod) {
op_focei.derivMethodSwitch=0;
Expand All @@ -4874,25 +4876,25 @@ NumericMatrix foceiCalcCov(Environment e){
cur = op_focei.fullTheta[j];
if (op_focei.nbd[k] == 1){
// Lower only
if ((cur-op_focei.lower[k])/cur < op_focei.boundTol){
if ((cur-op_focei.lower[k])/cur < op_focei.boundTol) {
boundary = true;
break;
boundStr += "\"" + thetaNames[j] + "\" ";
}
} else if (op_focei.nbd[k] == 2){
// Upper and lower
if ((cur-op_focei.lower[k])/cur < op_focei.boundTol){
if ((cur-op_focei.lower[k])/cur < op_focei.boundTol) {
boundary = true;
break;
boundStr += "\"" + thetaNames[j] + "\" ";
}
if ((op_focei.upper[k]-cur)/cur < op_focei.boundTol){
boundary = true;
break;
boundStr += "\"" + thetaNames[j] + "\" ";
}
} else {
// Upper only
if ((op_focei.upper[k]-cur)/cur < op_focei.boundTol){
boundary = true;
break;
boundStr += "\"" + thetaNames[j] + "\" ";
}
}
}
Expand Down Expand Up @@ -5306,8 +5308,8 @@ NumericMatrix foceiCalcCov(Environment e){
}
} else {
if (boundary){
warning(_("parameter estimate near boundary; covariance not calculated\n use 'getVarCov' to calculate anyway"));
e["covMethod"] = "Boundary issue; Get SEs with getVarCov";
warning(_("parameter estimate near boundary; covariance not calculated:\n ") + boundStr + _("\n use 'getVarCov' to calculate anyway"));
e["covMethod"] = "Boundary issue; Get SEs with `getVarCov()`: " + boundStr;
}
op_focei.cur=op_focei.totTick;
op_focei.curTick = par_progress(op_focei.cur, op_focei.totTick, op_focei.curTick, 1, op_focei.t0, 0);
Expand Down

0 comments on commit 49f2091

Please sign in to comment.