Jump to content


Photo

Make exception for execution error in NLME

NLME sort

  • Please log in to reply
6 replies to this topic

#1 jpenzens

jpenzens

    Member

  • Members
  • PipPip
  • 11 posts

Posted 29 November 2016 - 11:53 PM

Hi All,

 

I am trying to fit many data sets simultaneously by using the "Sort" option in NLME.  I am OK with an execution error for a single dataset (unique Sort), and this is also expected. However, when this occurs, the entire job gets aborted.  Is there a way to make the job continue, or another way to approach the problem?  I appreciate any help.

Cheers
Justin 



#2 Simon Davis

Simon Davis

    Advanced Member

  • Administrators
  • 1,329 posts

Posted 30 November 2016 - 08:58 AM

Justin, what is the error message you are seeing?

 

it may be easeir if you can post an example project, if yuo don't want it in then public domain, please mail it to Pharsight.Support@certara.com.

 

  Simon



#3 jpenzens

jpenzens

    Member

  • Members
  • PipPip
  • 11 posts

Posted 01 December 2016 - 01:57 AM

Hi Simon, 

Project attached.  Just a short background - I am trying to do many clinical trial simulations simultaneously.  There are three columns in the dataset that I have mapped to "Sort:"  Trial, Size, Nrep.  Trial is the trial type (different sampling regimens).  Size is the number of ID's, and Nrep is the copy number.  I have a large Nrep because the goal is to find power...

 

As you will see from the error file, this failed around run # 50, in about 10 minutes.  I would like phoenix to keep estimating another trial rather than stop w/ fatal error.

Thank you so much for your help.

Cheers,
Justin

Attached Files



#4 jpenzens

jpenzens

    Member

  • Members
  • PipPip
  • 11 posts

Posted 01 December 2016 - 12:33 PM

I was able to get NLME to estimate all of the datasets by resimulating the dataset from CObs = observe(C * (1 + EPS)), rather than C (D-OH!) and freeze() - ing the error().  Even if I appropriately simulate the dataset with error, I would still get the fatal error described previously, though less frequently.   It appears the fatal error comes from EPS approaching 0.

 

Two new questions - is there a smart way to place bounds on the error to prevent that from happening?  I was thinking error(EPS = ERR); stparm(ERR = c(0.1, 1, 10000) or something, however error requires a numeric argument.

 

Secondly, after the run finished, I got the error "Index was outside the bounds of the array."  The run did not output a Theta or Omega table, which is what I really need.

Thanks,
Justin 

 

 

Hi Simon, 

Project attached.  Just a short background - I am trying to do many clinical trial simulations simultaneously.  There are three columns in the dataset that I have mapped to "Sort:"  Trial, Size, Nrep.  Trial is the trial type (different sampling regimens).  Size is the number of ID's, and Nrep is the copy number.  I have a large Nrep because the goal is to find power...

 

As you will see from the error file, this failed around run # 50, in about 10 minutes.  I would like phoenix to keep estimating another trial rather than stop w/ fatal error.

Thank you so much for your help.

Cheers,
Justin



#5 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 02 December 2016 - 02:58 PM

Hi Justin,

 

Your suggestion not to interrupt the running process is quite reasonable!

 

I was able to get NLME to estimate all of the datasets by resimulating the dataset from CObs = observe(C * (1 + EPS)), rather than C (D-OH!) and freeze() - ing the error().  Even if I appropriately simulate the dataset with error, I would still get the fatal error described previously, though less frequently.   It appears the fatal error comes from EPS approaching 0.

What did you mean by C (D-OH!) ?

The fatal error appears when the solver gets in trouble. You cannot avoid it. Even if you change control mode from MPI to local the failed datasets will be different. Hard life of the modellers ))

You do not need to freeze the eps, because simulation engine does not fit the model.

 

Two new questions - is there a smart way to place bounds on the error to prevent that from happening?  I was thinking error(EPS = ERR); stparm(ERR = c(0.1, 1, 10000) or something, however error requires a numeric argument.

If you need some bounds I see 2 options:

1. to use more sophisticated error (CMixRatio or something else, you can tune up in the model text). At least you can rule it partially.

2. To use LL() statement (more complicated but very flexible)

An example for additional error:

 
fixef(CE = c(0,1,))
stparm(CEst = CE)
LL(CObs, (lnorm((CObs-C), CEst)))
 
Please note that the results would not be exactly the same as for built-in solution with observe() statement due to numerical issues and some other stuff even without boundaries. Try it at your own risk  :)
 
Secondly, after the run finished, I got the error "Index was outside the bounds of the array."  The run did not output a Theta or Omega table, which is what I really need.

 

Could you share the project? Support is always happy with new bug found!

 

BR,

Mittyright



#6 jpenzens

jpenzens

    Member

  • Members
  • PipPip
  • 11 posts

Posted 02 December 2016 - 03:27 PM

Hi mittyright,

 

Thanks for the help! 

What did you mean by C (D-OH!) ?

 

The dataset in the above project was built by simulating.  I had mistakenly sampled from the ODE solution ©, rather than CObs (ODE result + additive error).  I assume that was part of the reason I got into trouble with EPS approaching 0 (and thus asymptotically approaching -LL errors).  After I had fixed that, however, I still had runs that failed in the same way (LL out of bounds). 

 

You do not need to freeze the eps, because simulation engine does not fit the model.

This is bad news for me!  Actually, I was able to get theta, omega, and OF values for all of the runs after FIX-ing EPS!  It looks like they are all unique, too (but I will double check). 

Should I toss these results out and go back to the drawing board?

 

If you need some bounds I see 2 options:

1. to use more sophisticated error (CMixRatio or something else, you can tune up in the model text). At least you can rule it partially.

2. To use LL() statement (more complicated but very flexible)

An example for additional error:

 
fixef(CE = c(0,1,))
stparm(CEst = CE)
LL(CObs, (lnorm((CObs-C), CEst)))
 
Please note that the results would not be exactly the same as for built-in solution with observe() statement due to numerical issues and some other stuff even without boundaries. Try it at your own risk  :)

Thank you for the suggestions, I will give these a shot.  Could you perhaps provide sample code of <quote> (CMixRatio or something else, you can tune up in the model text). </quote>

 

Could you share the project? Support is always happy with new bug found!

 

 

I'll be happy to.  Again, thanks for all the help. 

 

Cheers,
Justin



#7 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 02 December 2016 - 09:06 PM

Hi Justin,

 

Should I toss these results out and go back to the drawing board?

 

just one more Certara modelling course is enough  ;)

 

Could you perhaps provide sample code of <quote> (CMixRatio or something else, you can tune up in the model text). </quote>

 

 

Please see attached.

 

Please note that CEps is just a sigma for distribution of residual error, so you cannot manage it like fixed effects. Even for CMixRatio CEps could be near 0 (theoretically).

You can investigate log-additive error where you never see the zero. But as I pointed before the solver fails sometimes 

 

BR, 

Mittyright

Attached Files


Edited by mittyright, 02 December 2016 - 09:12 PM.






Also tagged with one or more of these keywords: NLME, sort

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users