Re: [R] Not sure this is something R could do but it feels like it should be.
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 solution. Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Not sure this is something R could do but it feels like it should be.
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. All those things affect therapeutic dosing. I may have oversimplified what we are trying to achieve to avoid getting bogged down in the detail of what we are trying to achieve and provide something people might be able to relate to. However, we can assume that they are already sorted out, so we know the theoretically know what the 'correct' dose is for a patient. The hard bit is unless you want to give everyone liquid so you can measure any dose possible you have to have a dose that is a multiple of something (Amoxicillin doses in adults are multiples of 250 because thats the size of the capsule). 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%. 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). We are actually using a starting point that may be middle and going up and down if need be. I think what we may want to do is run a loop through each weight (in 1kg increments) and calculate their theoretical dose, and the dose for each possible starting point (there are certain contraints on that already so there may only be 20 possible start points), then we calculate the % variance for each dose to theoretical dose and calculate the Area Under Above (some will be negative) the curve and the one that has the lowest AUC is then the one that most precisely will dose the patient...? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Not sure this is something R could do but it feels like it should be.
On Jun 9, 2013, at 6:14 AM, Calum Polwart wrote: 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. All those things affect therapeutic dosing. I may have oversimplified what we are trying to achieve to avoid getting bogged down in the detail of what we are trying to achieve and provide something people might be able to relate to. However, we can assume that they are already sorted out, so we know the theoretically know what the 'correct' dose is for a patient. The hard bit is unless you want to give everyone liquid so you can measure any dose possible you have to have a dose that is a multiple of something (Amoxicillin doses in adults are multiples of 250 because thats the size of the capsule). I think you may have under-simplified rather than over-simplified. There is no such thing as getting bogged down in detail. We need all the relevant details. I suspect that you have in mind a situation where you have multiple drugs and multiple forms in which they can be administered and are hoping for a processing method that rounds to the nearest tespoonful or tablet size given some set of patient specific factors such as age sex height or weight. If my guess is correct then you need to offer a sample set of data of at least theree types for A) drugs and phamacokinetic parameters, B) dosage forms, C) patient features. You also need to supply rules for rounding to he nearest nice unit of administration. 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%. 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). We are actually using a starting point that may be middle and going up and down if need be. You need to describe explicitly how that determination is made. I think what we may want to do is run a loop through each weight (in 1kg increments) and calculate their theoretical dose, and the dose for each possible starting point (there are certain contraints on that already so there may only be 20 possible start points), then we calculate the % variance for each dose to theoretical dose and calculate the Area Under Above (some will be negative) the curve and the one that has the lowest AUC is then the one that most precisely will dose the patient…? I think you need to classify what pharmacokinetics apply to a particular drug (zeroth, or first order kinetics, volume of distribution affected by whatever) and choose from a limited number of heuristics for drugs rahter than solving each case from first principles. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Not sure this is something R could do but it feels like it should be.
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 This message may contain confidential information. If yo...{{dropped:22}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Not sure this is something R could do but it feels like it should be.
On Jun 6, 2013, at 10:03 AM, Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) calum.polw...@nhs.net 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 The first place I would start is with the two relevant CRAN Task Views: http://cran.r-project.org/web/views/ClinicalTrials.html and http://cran.r-project.org/web/views/Pharmacokinetics.html There is also another package not listed above that might be relevant: http://cran.r-project.org/web/packages/scaRabee/ Regards, Marc Schwartz __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Not sure this is something R could do but it feels like it should be.
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 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.