Package-free solution [PK / PD]

posted by ElMaestro  – Denmark, 2013-07-17 23:53 (4355 d 07:31 ago) – Posting: # 11006
Views: 22,940

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,424 posts in 4,927 threads, 1,676 registered users;
41 visitors (0 registered, 41 guests [including 10 identified bots]).
Forum time: 07:24 CEST (Europe/Vienna)

Complex, statistically improbable things are by their nature
more difficult to explain than
simple, statistically probable things.    Richard Dawkins

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