# [R] Not sure this is something R could do but it feels like it should be.

Jim Lemon jim at bitwrit.com.au
Fri Jun 7 01:59:19 CEST 2013

```On 06/07/2013 01:03 AM, Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS
FOUNDATION TRUST) wrote:
> Some colleagues nationally have developed a system which means they can pick the optimal sets of doses for a drug.  The system could apply to a number of drugs.  But the actual doses might vary.  To try and explain this in terms that the average Joe on the street might understand if you have some amoxicillin antibiotic for a chest infection the normal dose for an adult is 250 to 500mg increased to maybe 1000mg in severe cases.
>
> For a child it is dosed from a liquid and people usually go from 62.5mg, 125mg to 250mg although you could measure any volume you wanted.
>
> What this new method has developed is a means to pick the "right" standard doses so what above is 62.5, 125, 250, 500, 1000.  However the method they've used is really engineered about ensure the jump between doses is correct - you'll notice that the list above is a doubling up method.
>
> But you can also have a doubling up method that went 50, 100, 200, 400, 800, 1600  and pretty much as many as you can think of depending on your starting point and there is no scientific means to pick that starting point.  So colleagues have developed their rather more complex equivalent of the doubling method to determine the doses they need but they need to know if they should start at 40, 50, 62.5 or some other number.
>
> Once they have the starting number they can calculate all the other doses.  I realise R can do that, and I realise using a loop of possible starting numbers it can build all those options.
>
> Each patient then has a theoretical dose they should get lets say that's 10mg/kg and you might treat patients from 5 to 120kg.  They are then looking to calculate the variance for each dose range so if we take the 50, 100, 200, 400 model and said you'd give 50mg to anyone needing 0?? to 75mg 100mg to anyone needing 76 - 150mg etc... from there they are taking that range and saying that's a 31% overdose to a 33% underdose.  Then they want to find if there is a starting number which minimises the extent of under and overdosing...
>
> Anyone know of an existing stats function in R that can easily do that and almost then report from some inputs a single number that is the "best fit"?
>
> Calum
>
Hi Calum,
I can only answer from the perspective of someone who calculated doses
of alcohol for experimental subjects many years ago. It was not possible
to apply a linear function across the range due to a number of factors.
One is that BAC, which was the target value, is dependent upon the
proportion of the weight that represents the water compartment of the
body. This varies with both weight (heavier people typically have a
higher proportion of fat) and sex (women also tend to have slightly more
fat). The real monkey wrench in the works was absorption rate, which
often made nonsense of my calculations. This may not be as important in
therapeutic drugs, for we were aiming at a specified BAC at a certain
time after dosing rather than an average level. However, I suspect that
many therapeutic drugs have a different dose by weight for children (we
weren't dosing children) and choosing a starting point at the bottom of
the range would almost certainly introduce a systematic error. My
intuition would be to anchor the dosage rate in the middle of the scale
and then extrapolate in both directions (adults only, of course).

Jim

```