Jump to content


Photo

time-varying residual error model

residual error

  • Please log in to reply
5 replies to this topic

#1 niujing23@gmail.com

niujing23@gmail.com

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 28 August 2016 - 07:34 PM

Dear Certara Forum users,

I am modeling a long-acting release form and my absorption model can't fit very well. I am trying to use time-varying residual error model to fix my absorption phase.

 

My approach is like below: first create a categorical variable using absTime = if(Time__hr_<=24,1,0), then using two seperate proportional error terms for the absorption and distribution phase:

stparm(CMultStdev = tvCMultStdev*(absTime==0)+tvCMultStdev_absTime*(absTime==1))

 

This approach works, I am wondering is there a way that I can code directly in PML (without creating the dummy variable absTime), maybe use if else statement?

 

Thanks in advance,

Jing Niu

CTM, University of Maryland

 



#2 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 28 August 2016 - 08:55 PM

Dear colleague

I am attaching a project I just made that answers your question.

You need to use the group statement to define the conditions on the time and then you can write the condition into the stparm.

If you want to use QRPEM, you need to put the if condition outside the stparm.

I tested my code by simulation and then fitting and it works.

Hope it helps.

best

Serge

Attached Files



#3 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 29 August 2016 - 10:29 AM

Dear Jing Niu,

you can even simplify it to
stparm(CMultStdev = t<=24?tvCMultStdev:tvCMultStdev_absTime)

 

So you can use ternary operator as a substitution of ifelse statement. In this case you don't need group() statement.

But Serge's code is better because you can add index to Variables in output table for tracking.

 

Dear Serge,

 

I suppose this line in your project

stparm(CMultStdev = tvCMultStdev)

 

is superfluous

 

Have a good day!

Mittyright


Edited by mittyright, 29 August 2016 - 10:30 AM.


#4 serge guzy

serge guzy

    Advanced Member

  • Members
  • PipPipPip
  • 485 posts

Posted 29 August 2016 - 10:33 AM

Dear Jing Niu,

you can even simplify it to
stparm(CMultStdev = t<=24?tvCMultStdev:tvCMultStdev_absTime)

 

So you can use ternary operator as a substitution of ifelse statement. In this case you don't need group() statement.

But Serge's code is better because you can add index to Variables in output table for tracking.

 

Dear Serge,

 

I suppose this line in your project

stparm(CMultStdev = tvCMultStdev)

 

is superfluous

 

Have a good day!

Mittyright

Yes, it was the original stparm but you are right, no use of the original Cmultstdev.

What is interesting is that Phoenix did not complaint but you did and you were right.

Best

Serge



#5 niujing23@gmail.com

niujing23@gmail.com

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 29 August 2016 - 02:23 PM

Dear Serge and Mittyright,

Thanks for your reply and it's really helpful.

I guess if two lines of code were used to define the same variable, the latter one will cover the first one. Like in our case, stparm(CMultStdev = tvCMultStdev) was ignored.

Jing Niu



#6 mittyright

mittyright

    Advanced Member

  • Members
  • PipPipPip
  • 98 posts

Posted 29 August 2016 - 02:31 PM

Dear Jing Niu,

 

you are right,  the latter one will cover the first one, but this could be confusing for the users. Moreover, some reference from PML User's guide:

in a PML model, the statements are not sequential, they are descriptive of the problem.

They do not take action at a point in time. Rather they apply “all the time”. So in PML code, outside of
sequence blocks (and assignment statements), relative order of statements does not matter.
 
so I would not bet about right stparm statement in case of multiple usage.
 
BR,
Mittyright






Also tagged with one or more of these keywords: residual error

2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users