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

Jim Lemon jim at bitwrit.com.au
Mon Jun 10 11:44:39 CEST 2013

On 06/09/2013 11:14 PM, Calum Polwart wrote:
> ...
> What we are trying to do is determine the most appropriate number to
> make the capsules. (Our dosing is more complex but lets stick to
> something simple. I can safely assure you that vritually no-one actually
> needs 250 or 500mg as a dose of amoxicillin... ...thats just a dose to
> get them into a therapeutic window, and I'm 99% certain 250 and 500 are
> used coz they are round numbers. if 337.5 more reliably got everyone in
> the window without kicking anyone out the window that'd be a better dose
> to use! So... what I'm looking to do is model the 'theoretical dose
> required' (which we know) and the dose delivered using several starting
> points to get the 'best fit'. We know they need to be within 7% of each
> other, but if one starting point can get 85% of doses within 5% we think
> that might be better than one that only gets 50% within 5%.

Okay, I think I see what you are attempting now. You are stuck with 
fairly large dosage increments (say powers of two) and you want to have 
a "base" value that will be appropriate for the greatest number of 
patients. So, your range of doses can be generated with:

d * 2 ^ (0:m)

where d is some constant and m+1 is the number of doses you want to 
generate. For your amoxcillin, d=250 and m=1, so you get 250 and 500mg. 
Given this relationship (or any other one you can define), you want to 
set your base dose so that it is close to the mode of the patient 
distribution. This means that the greatest number of patients will be 
suitably dosed with your base dose. I would probably try to solve this 
by brute force, setting the base dose at the mode and then moving it up 
and down until the dose was appropriate for the largest number of patients.

However, there are a lot of people on this list who would be more 
familiar with this sort of problem, and there may be a more elegant 


More information about the R-help mailing list