Package-free solution [PK / PD]

posted by ElMaestro  – Denmark, 2013-07-17 23:53 (4373 d 22:52 ago) – Posting: # 11006
Views: 23,013

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,428 posts in 4,929 threads, 1,693 registered users;
44 visitors (0 registered, 44 guests [including 7 identified bots]).
Forum time: 22:45 CEST (Europe/Vienna)

Anyone who conducts an argument by appealing to authority
is not using his intelligence;
he is just using his memory.    Leonardo da Vinci

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