Salacious title, but true story.

 dmethyl1 = {
      {0, 0},
      {.25, 1},
      {.5, 7},
      {1, 26},
      {1.5, 40},
      {2, 45},
      {2.5, 45},
      {3, 44},
      {3.5, 44},
      {4, 43},
      {4.5, 41},
      {5, 39},
      {6, 38},
      {7, 37},
      {8, 35},
      {9, 33},
      {10, 32},
      {11, 29},
      {12, 24},
      {24, 13},
      {48, 4},
      {60, 2},
      {72, 0}

This data set represents d-amph serum concentrations as a function of time after taking a single dose 30mg of Adderall.

cmaxd = Interpolation[dmethyl1, InterpolationOrder -> 3]

Gives the interpolation function. I need to translate this into a crude multi dose model. I need work out how to write a function that works like:


I'm having a hard time figuring out how to limit the range of the shifted functions before I add them. Its been ages since I've worked with math software. I am aware of the pharmacokinetic limitations of this kind of model. The DA is using a a wildly unrealistic reference range based on a 1x daily dosage. I just need to rebut that point.

She's really cute. My girlfriend, not the DA. Any help appreciated.

  • 1
    $\begingroup$ I feel as though this question is dependent on some knowledge not included therein. What exactly is the nature of the multi-dose-model you wish to create? Could you give a small example of how you want this to work? $\endgroup$
    – Mr.Wizard
    Commented Jan 22, 2017 at 8:39
  • 30
    $\begingroup$ Umm, "Hire an expert witness" would be the standard way to go about this sort of thing. (Yes, I realize they cost real money.) $\endgroup$ Commented Jan 22, 2017 at 17:19
  • 4
    $\begingroup$ Daniel You are absolutely correct. Hire an expert witness is the ideal solution, unfortunately, we had to hire attorneys in two states prior to the blood work coming back which has exhausted most of our available resources(>20k USD so far). The situation has spiraled completely out of control. I'm hesitant to post all of the details as it is a pending legal matter. I am extremely grateful for the help Mr. Wizard, J.M, swisher, and Bobthechemist and ubpdqn have provided so far. I'd like to send you guys an Amazon or iTunes Gift Card for your efforts. I'll PM each of you. $\endgroup$ Commented Jan 22, 2017 at 21:10
  • 2
    $\begingroup$ @user46047 The toxicology lab used an immunoassay which is reactive to amphetamine generically. They methyl- part was simply my error in writing. Taking your medication as prescribed is not a defense for duid charge, but the district attorney is arguing that a felony charge is justified because her amphetamine level was significantly higher than the 20-50ng/ml level his reference range says is considered therapeutic. The analytes are d-amph, and l-amph. In this case the test was measuring (d-amph+l-amph). They did not run GC to differentiate. $\endgroup$ Commented Jan 23, 2017 at 7:15
  • 2
    $\begingroup$ Going in with all the knowledge you can muster is a good idea, and there are respondents in this thread who have no doubt been extremely helpful in that regard. But again, you both really need to discuss with legal counsel how to present appropriate expertise. It is costly, I'm afraid there is no getting around that. $\endgroup$ Commented Jan 24, 2017 at 20:03

5 Answers 5


Similar to previous answers, only I don't make the instantaneous absorption assumption since it isn't really necessary. The equation can be found here on page three, where ka and ke are the rates of absorption and elimination, respectively, D is the initial dose (in ng), V/F is the Volume of Distribution. The range of apparent volumes of distribution I've seen for Adderall are from 271 (F = 0.92, V = 250 mL) to 485 mL. The previous references give estimates for the absorption rate constant of ~ 1/h and since the elimination rate must be much less than ka in order to get the observed concentration profile, we have parameter estimates of (d = 30000, v = 250, f = 0.92, ka = 1, ke = 0.1). I combine fd/v = const = 110 since the model cannot discriminate these values. I'm assuming that the y axis in the original data is in ng/mL.

f1[t_, ka_, ke_, const_: 0.92*30000/250] := 
 const ka/(ka - ke) (Exp[-ke t] - Exp[-ka t])
nlm = NonlinearModelFit[dmethyl1, 
  f1[t, ka, ke, const], {{ka, 1}, {ke, 0.1}, {const, 110}}, t]

enter image description here

Nonlinear model fitting with reasonable parameter estimates yields a reasonable fit, with ka = 0.72 h^-1, ke = 0.072 h^-1 and fd/v = 56. ke and fd/v appear to be highly correlated; however fixing fd/v to the range of literature values does not appear to change the best-fit parameter values beyond the range of the standard errors.

The bottom of page 3 here provides the multi-dose first-order adsorption/elmination equation, which can be written as

f3[t_, ka_, ke_, const_, dt_, n_] :=
 Sum[const ka/(ka - ke) (Exp[-ke (t - dt i)] - 
     Exp[-ka (t - dt i)]) UnitStep[t - dt i], {i, 0, n}]

where dt is the dosing interval and n is the number of doses. In my simplified case, the dosing interval must be constant and must be the same amount as the original dose. An example with 6 doses spaced 12 hours apart:

Plot[f3[t, ka, ke, const, 12, 6] /. nlm["BestFitParameters"], {t, 0, 
  96}, Frame -> {True, True, False, False}, 
 FrameLabel -> {"Time (h)", "Amount (ng/mL)"}, 
 PlotLabel -> "Multi-dose absorption/elimination curve"]

enter image description here

  • $\begingroup$ That Su paper you linked to is nice. And they're from Merck to boot! $\endgroup$ Commented Jan 22, 2017 at 17:47
  • 1
    $\begingroup$ @bobthechemist Thank you for this model. The young woman in question has an fairly extreme outlier body type. 44kg, 160cm, BMI 17.5. The data set I drew from SLI381-111 is built from a sample N=18(14m/4f), mean weight = 73kg, mean height = 175cm, mean BMI 24.5. Do you have any recommendation on the best weigh to present an adjustment on the basis of weight? $\endgroup$ Commented Jan 22, 2017 at 23:38
  • 1
    $\begingroup$ Shire's Labeling Claims "Gender Systemic exposure to amphetamine was 20-30% higher in women (N=20) than in men (N=20) due to the higher dose administered to women on a mg/kg body weight basis. When the exposure parameters (Cmax and AUC) were normalized by dose (mg/kg), these differences diminished. Age and gender had no direct effect on the pharmacokinetics of d- and l-amphetamine." Is it reasonable to simply show the adjustment by using 1.3*F3? $\endgroup$ Commented Jan 22, 2017 at 23:40
  • 3
    $\begingroup$ @PrisonersDilema I have no experience in pharmacokinetics (I'm looking at this strictly from a modeling perspective) so my opinion is not terribly useful. Page 17 of the fda report I cite in my answer addresses weight and gender, and you might have some luck wading through that information. $\endgroup$ Commented Jan 22, 2017 at 23:59

Assuming the simplest kinetic model for elimination (and making the simplifying assumption of "instant absorption" to peak concentration):

conc = {{0, 0}, {.25, 1}, {.5, 7}, {1, 26}, {1.5, 40}, {2, 45}, {2.5, 
    45}, {3, 44}, {3.5, 44}, {4, 43}, {4.5, 41}, {5, 39}, {6, 38}, {7,
     37}, {8, 35}, {9, 33}, {10, 32}, {11, 29}, {12, 24}, {24, 
    13}, {48, 4}, {60, 2}, {72, 0}};
lp = ListPlot[conc];
em = conc[[6 ;;]];
nlm = NonlinearModelFit[em, { a Exp[- k t]}, {a, k}, t]
Show[lp, Plot[Evaluate@nlm[t], {t, 2, 72}]]
tc = k /. nlm["BestFitParameters"];
halflife = t /. Quiet[Solve[f[45, t] == 22.5, t][[1]]]
f[a_, t_] := a Exp[- tc t]
p[i_, n_] := Nest[f[#, i] + 45 &, 45, n]
pf[i_, n_] := 
    f[p[i, j], t - j i] UnitBox[(t - j i )/i - 1/2], {j, 0, n}];
 Plot[pf[interval, 10], {t, 0, 10 interval}, Exclusions -> None, 
  PlotRange -> {0, 200}, Frame -> True, 
  GridLines -> {{4 halflife}, None}], {interval, {5, 8, 10, 12, 24}}]

From the single dose the half-life is approximately 12 hours. Therefore, approximately 48 hours to steady state. The Manipulate shows effect of different dosing intervals (10 intervals shown):

enter image description here

  • $\begingroup$ Looks about right to me; +1. But the halflife computation should come after the definition for f, no? $\endgroup$ Commented Jan 22, 2017 at 10:49

I have no experience with what you are trying to do so this is entirely guesswork but maybe you want something like this?

cmaxd = Interpolation[dmethyl1, InterpolationOrder -> 1];

f1[t_?NumericQ] := If[0 <= t <= 72, cmaxd[t], 0]

f2[t_] := Sum[f1[t - i], {i, 0, t, 12}]

Plot[f2[i], {i, 0, 120}, AxesLabel -> {"hour", "concentration"}]

enter image description here

  • $\begingroup$ It will take me some time to understand what you did, but yes, this looks like what I am going for. Thank you sir. $\endgroup$ Commented Jan 22, 2017 at 9:04
  • $\begingroup$ @PrisonersDilema Okay, let me know if you have any questions. f1 is just a way to limit the input to the InterpolatingFunction so it doesn't see something outside its range and give erroneous extrapolation. $\endgroup$
    – Mr.Wizard
    Commented Jan 22, 2017 at 9:06

You can also do it with some timeseries arithmetic.

Construct $n$ shifted by 12 hours series:

n = 10

doses = Table[TimeSeriesShift[dmethyl1, {k, 12}], {k, 0, n-1}];

Combine them with interpolation order of 0 (extrapolation would be zero outside the domain intervals this way):

Off[InterpolatingFunction::dmval] (* Disable extrapolation warnings *)

ListLinePlot@TimeSeriesThread[Total, doses , 
   ResamplingMethod -> {"Interpolation", InterpolationOrder -> 0}]

enter image description here


Your problem, as stated, is insoluble for several reasons: methamphetamine is not a significant metabolite of amphetamine, and hence the data provided, which you refer to as indicating D-methamphetamine measurements at various times, cannot be informative as to the effects of the 30 mg Adderal you say your girlfriend had consumed. Adderal contains a mixture of amphetamine salts, none of which are methylated in vivo to a significant extent. Clearly, it's important to know which drug was taken and/or analyzed.

Further the manner in which the kinetics are relevant to the criminal matter is not clear from your post, so it is not possible to answer the portion of your question seeking confirmation of the state's position being unreasonable. This is because you have not said what the relevance of the kinetic determination is to the criminal case. Simply, it isn't clear whether, a vindication of your condemnation of the state's model is material to this case, making it impossible to determine whether the math supports your gf in the way you hope. (i.e. a D.A. that is wrong, even wildly so, may not be material to the question of your gf's guilt depending on the law.)

If you could indicate the relevance you assign to the state's kinetic model being wrong, i.e. clarify the operative law here is, we can better address your question. For example: some states establish it as a criminal offense to have any amount of drug or metabolite in ones body while driving, even if completely unaffected (indeed, even if the substance isn't pharmacalogically active, it may still sustain a conviction- under such law the state's wild guesses probably aren't going to matter.) On the other hand, some states require a person to be impaired before they are criminally culpable, and yet others add a supplemental threshold concentration of drug which, if present, renders the driver impaired as a matter of law.

Should the foregoing particulars be clarified, there is a great body of literature on meth/amphetamine toxicology that could be brought to bear on this question. Of note, due to its large aryl moiety and basic amine function, the pH of body fluids is of peculiar effect on amphetamine absorption, membrane permeability, and excretion rate, so this is a case where the uncertainty in pre-testing concentrations, and even what the biological effect of a given concentration, is much greater than what a D.A. may be used to from ethanol or other drug cases involving less fickle substances. (This effect is less pronounced in the case of methamphetamine, i.e. should it have been Desoxyn she consumed, making it all the more important we know what drug your girlfriend consumed and what the analyte was in the figures you gave us.)

Should you clear up the uncertainties which prevent your questions from being answered I'd be happy to do my best, my questionable qualifications notwithstanding, to nail down what was going on before the blood testing.

  • $\begingroup$ This is, first and foremost, a site for Mathematica users; tho sections of your contribution are pertinent to the case at hand, this is not really an answer, and I thus moved your previous contribution to the comments, as opposed to deleting it. Had you combed through it, you would not have said s…tuff like "My previous reply was removed for violating the rules." (I have CW'd this in the meantime.) $\endgroup$ Commented Jan 23, 2017 at 9:38
  • $\begingroup$ Toxicology screened for serum amphetamine. The test did not differentiate among amphetamine analytes She was prescribed 60mg Adderall daily(damph, l-amph). 30mg 2x Daily. What she was taking is not in question. The DA is asserting the therapeutic range is 20-50ng/ml. She tested between 125 and 175ng/ml. I do not want to report the exact value. There is no per se limit for duid in this state, but the charges can and are being escalated to a felony because the level was very high according to the DAs reference range. If she was taking meds as prescribed, the charges are different. $\endgroup$ Commented Jan 23, 2017 at 15:30
  • $\begingroup$ Are you sure there even is criminal culpability if the medication was taken as described and consistant with medical advice? I'd imagine that would be inconsistant with conviction, if you indicate the state I can check. So it sounds like you at least hope to show this isn't a felony case as the evidence doesnt support the level of consumption the state alleges. It also sounds like you have a great shot at showing their was no impairment anyways, or at least no culpable mindstate if the drugs were taken as directed. $\endgroup$
    – user46047
    Commented Jan 23, 2017 at 19:29
  • $\begingroup$ @Memo, "analyte" is indeed the term of art for the substance being sought in an analysis. $\endgroup$ Commented Jan 23, 2017 at 21:14
  • $\begingroup$ @J.M. my apologies. i didn't know analyte was a work and it turned up as an error in the Chrome Spellchecker and re-reading it i felt analysis would have been correct. i'll remember it for next time $\endgroup$
    – Memor-X
    Commented Jan 23, 2017 at 21:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.