From: John Warner <*John.Warner*>

Date: Mon, 14 Sep 2015 15:36:15 +0000

Thanks Again Erik

I think your solution solves the problem. I just did a quick experiment an=

d, at least in the simple case that I tried, pred-defined variables do seem=

to be persistent between calls. So I am not even sure that saving the stat=

e variables to ai's is necessary as long as I do all my work in user define=

d code as opposed to subroutine calls.

So all of this may have been a tempest in a tea pot.

Nonetheless your advice was right on and I thank you for it.

Also thanks to all Kevin and Jason for their helpful comments.

Best

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

Sent: Monday, September 14, 2015 11:21 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

John,

My understanding is that the variables to be used recursively should be ref=

erenced, so the simplest form is Ai = Ai. (Note that if ETAs are involved=

, also the derivatives of the Ai with respect to the ETAs need to be tracke=

d, but NM-TRAN does this for you).

Best regards,

Erik

________________________________

From: John Warner [John.Warner

Sent: Monday, September 14, 2015 4:38 PM

To: Olofsen, E. (ANST); nmusers

m>

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Thanks again Erik

I think my code would work with the Ai's alone provided that they persist u=

nchanged between calls to $pred. Do they?

I guess the general question for me is when do user-defined variables persi=

st unchanged between calls to $pred? If the answer is "always" they I am i=

n good shape.

Best

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

]

Sent: Monday, September 14, 2015 10:31 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

John,

Would your Kalman filter implementation work with just a $PRED, so without =

a $MODEL? While the A(i) are the amounts in compartments defined in $MODEL,=

the Ai are user-defined variables.

Best regards,

Erik

________________________________

From: John Warner [John.Warner

Sent: Monday, September 14, 2015 4:09 PM

To: Olofsen, E. (ANST); nmusers

m>

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Thanks Eric

Yours seems like a very straight-forward and complete solution. However, i=

f I am not mistaken, the Ai variables are created by $model and I am not su=

re that $model can be used by a user supplied $pred. If it can, there rema=

ins the problem of calling the model subroutine. I assume that this would =

be done with verbatim code but I am not sure where to put such a call in my=

control stream. The documentation (html help files) states that $model is=

called only once by the PREDPP subroutines that use it. Perhaps I could p=

ut such a call in the $input or $pk records? $PK would seem more logical b=

ut it is not clear that this record is available outside of predPP.

I am very interested to hear any additional responses to this.

Thanks again.

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

]

Sent: Monday, September 14, 2015 4:40 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Dear John,

In the code by Tornoe et al., state variables A(i) are stored in the Ai var=

iables, and retrieved by statements Ai = Ai. Such recursive code is descr=

ibed in NONMEM's help on abbreviated code. Although the A(i) are associated=

with differential equations, you could perhaps still use such recursive st=

atements, indicating that you want to store and retrieve information?

Best regards,

Erik

________________________________

From: owner-nmusers

ner-nmusers

ation.org]

Sent: Sunday, September 13, 2015 11:24 PM

To: nonmem usersgroup

Subject: [NMusers] Implementing a Kalman Filter based optimization in NONME=

M

Dear NONMEM users

I am attempting to implement a Kalman Filter based optimization in NONMEM u=

sing $PRED directly. The method I am attempting to implement is similar i=

n spirit to that presented in Tornoe et. al. (2005) (and the NONMEM 7.3 man=

ual) except that I have no need for a differential equations solver. In e=

ffect I can solve the differential equations analytically but I still need =

to estimate a random walk error term. Adapting the procedure of Tornoe et.=

al. 2005 seems straight-forward except that, it seems to me, I need to fin=

d a way to store the state vector and associated partial derivatives at the=

end of a call to $PRED and to retrieve them at the beginning of the next c=

all for the same subject. I assume that something like this must be done b=

y ADVAN6 when differential equations are solved.

I would be very grateful for any advice on this.

Best

John

Tornoe et. al. Stochastic Differential Equations in NONMEM(r): Implementa=

tion, Application, and Comparison with Ordinary Differential Equations Ph=

armaceutical Research, Vol. 22, No. 8, August 2005 2005)

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

Received on Mon Sep 14 2015 - 11:36:15 EDT

Date: Mon, 14 Sep 2015 15:36:15 +0000

Thanks Again Erik

I think your solution solves the problem. I just did a quick experiment an=

d, at least in the simple case that I tried, pred-defined variables do seem=

to be persistent between calls. So I am not even sure that saving the stat=

e variables to ai's is necessary as long as I do all my work in user define=

d code as opposed to subroutine calls.

So all of this may have been a tempest in a tea pot.

Nonetheless your advice was right on and I thank you for it.

Also thanks to all Kevin and Jason for their helpful comments.

Best

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

Sent: Monday, September 14, 2015 11:21 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

John,

My understanding is that the variables to be used recursively should be ref=

erenced, so the simplest form is Ai = Ai. (Note that if ETAs are involved=

, also the derivatives of the Ai with respect to the ETAs need to be tracke=

d, but NM-TRAN does this for you).

Best regards,

Erik

________________________________

From: John Warner [John.Warner

Sent: Monday, September 14, 2015 4:38 PM

To: Olofsen, E. (ANST); nmusers

m>

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Thanks again Erik

I think my code would work with the Ai's alone provided that they persist u=

nchanged between calls to $pred. Do they?

I guess the general question for me is when do user-defined variables persi=

st unchanged between calls to $pred? If the answer is "always" they I am i=

n good shape.

Best

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

]

Sent: Monday, September 14, 2015 10:31 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

John,

Would your Kalman filter implementation work with just a $PRED, so without =

a $MODEL? While the A(i) are the amounts in compartments defined in $MODEL,=

the Ai are user-defined variables.

Best regards,

Erik

________________________________

From: John Warner [John.Warner

Sent: Monday, September 14, 2015 4:09 PM

To: Olofsen, E. (ANST); nmusers

m>

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Thanks Eric

Yours seems like a very straight-forward and complete solution. However, i=

f I am not mistaken, the Ai variables are created by $model and I am not su=

re that $model can be used by a user supplied $pred. If it can, there rema=

ins the problem of calling the model subroutine. I assume that this would =

be done with verbatim code but I am not sure where to put such a call in my=

control stream. The documentation (html help files) states that $model is=

called only once by the PREDPP subroutines that use it. Perhaps I could p=

ut such a call in the $input or $pk records? $PK would seem more logical b=

ut it is not clear that this record is available outside of predPP.

I am very interested to hear any additional responses to this.

Thanks again.

John

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

From: E.Olofsen

]

Sent: Monday, September 14, 2015 4:40 AM

To: John Warner; nmusers

Subject: RE: Implementing a Kalman Filter based optimization in NONMEM

Dear John,

In the code by Tornoe et al., state variables A(i) are stored in the Ai var=

iables, and retrieved by statements Ai = Ai. Such recursive code is descr=

ibed in NONMEM's help on abbreviated code. Although the A(i) are associated=

with differential equations, you could perhaps still use such recursive st=

atements, indicating that you want to store and retrieve information?

Best regards,

Erik

________________________________

From: owner-nmusers

ner-nmusers

ation.org]

Sent: Sunday, September 13, 2015 11:24 PM

To: nonmem usersgroup

Subject: [NMusers] Implementing a Kalman Filter based optimization in NONME=

M

Dear NONMEM users

I am attempting to implement a Kalman Filter based optimization in NONMEM u=

sing $PRED directly. The method I am attempting to implement is similar i=

n spirit to that presented in Tornoe et. al. (2005) (and the NONMEM 7.3 man=

ual) except that I have no need for a differential equations solver. In e=

ffect I can solve the differential equations analytically but I still need =

to estimate a random walk error term. Adapting the procedure of Tornoe et.=

al. 2005 seems straight-forward except that, it seems to me, I need to fin=

d a way to store the state vector and associated partial derivatives at the=

end of a call to $PRED and to retrieve them at the beginning of the next c=

all for the same subject. I assume that something like this must be done b=

y ADVAN6 when differential equations are solved.

I would be very grateful for any advice on this.

Best

John

Tornoe et. al. Stochastic Differential Equations in NONMEM(r): Implementa=

tion, Application, and Comparison with Ordinary Differential Equations Ph=

armaceutical Research, Vol. 22, No. 8, August 2005 2005)

John H. Warner, PhD, MBA

Director, Biostatistics

CHDI Management / CHDI Foundation

155 Village Boulevard, Suite 200

Princeton, NJ, 08540

(609) 945-9644: office

(609) 751-7345: cell

(609) 452-2160: fax

john.warner

Received on Mon Sep 14 2015 - 11:36:15 EDT