Package-free solution [PK / PD]

posted by ElMaestro  – Denmark, 2013-07-17 23:53 (4710 d 23:38 ago) – Posting: # 11006
Views: 25,428

Hi John,

Here's an offer of a quick and dirty package-free approach to yung-jin's dataset:

Conc=function(D, K01, K10, V, t, tlag)
{
 C = ((D*K01)/(V*(K01-K10))) * (exp(-K10*(t-tlag)) - exp(-K01*(t-tlag)))
 return(C)
}

Cx=Conc(100, 1.67, 0.213, 10, 6, 0.5)
Cx ## this is the known!
##Let's assume we know D, K01, V, tlag
##We want to find a K10 that gives this result Cx at the given t.

K01_fubar=function(K01start, K01end, Gridsize)
{
 tmpK01=K01start
 hotK=K01start
 minDiff=123456789e54321
 d=(K01end-K01start)/Gridsize
 for (i in 1:Gridsize)
   {
   if (abs(Cx-Conc(100, tmpK01, 0.213, 10, 6, 0.5))<minDiff)
    {
      minDiff=abs(Cx-Conc(100, tmpK01, 0.213, 10, 6, 0.5))
      hotK=tmpK01
    }
   tmpK01=tmpK01+d
   }
 return(hotK)
}

Solution=K01_fubar(0.001, 10.0, 10000)
Solution
##want more decimals?? the interval above had a grid denisty of (10.0-0.001)/10000 so...
d=(10.0-0.001)/10000
Solution=K01_fubar(Solution-d, Solution+d, 10000)
Solution

Pass or fail!
ElMaestro

Complete thread:

UA Flag
Activity
 Admin contact
23,653 posts in 4,991 threads, 1,570 registered users;
123 visitors (0 registered, 123 guests [including 22 identified bots]).
Forum time: 23:32 CEST (Europe/Vienna)

In theory, there is no difference between theory and practice.
But, in practice, there is.    Jan L.A. van de Snepscheut

The Bioequivalence and Bioavailability Forum is hosted by
BEBAC Ing. Helmut Schütz
HTML5