# From the data the growth of tumor spheroids determine doubling time using Mathematica and by hand

Task: From the data the growth of tumor spheroids determine doubling time Link to the data.

My idea was to use least squares method and Mathematica to helps me find result. But I think that this is nonlinear problem so I will have to use nonlinear least squares method but I don't know how to start. Also I have a question how does my result change if I add some data or throw away.

• Not a Mathematica tip, but consider taking the log size. Exponential growth is linear on a log scale. – Chris K Nov 3 '16 at 12:48
• You should follow @ChrisK 's advice and maybe even take logs of both variables (time and volume) and be prepared for the better fit having the doubling time dependent on time. If you provide a start with some Mathematica code (after looking at the documentation for LinearModelFit and NonlinearModelFit), you'll likely get more help. (And don't throw away any inconvenient data.) – JimB Nov 3 '16 at 15:15
• A plot of the complete dataset that you've posted in a comment to @uppdqn leads me to believe that either the measurement variability increases in time (or in volume of tumor) or that you have measurements from multiple tumors. If you have measurements from multiple tumors, then having that information in your data is critical to getting results from which you can make valid/useful inferences. If you only have measurements from a single tumor, then making inferences to all tumors would be a bit weak. – JimB Nov 4 '16 at 14:42
• @SKZagreb thank you for the accept but Jim Baldwin''s answer is much better, uses the full data and as he observes the simple exponential growth model is not a good fit (and hence 'doubling time' relevance except for the initial unrestricted growth). Good luck:) – ubpdqn Nov 5 '16 at 9:03

With your full set of data ones sees the following:

data = {{4.56, 0.0016308}, {5.66, 0.0032148}, {6.68, 0.005614},
{7.89, 0.0118598}, {8.81, 0.02015}, {9.79, 0.027538}, {10.99, 0.034546},
{11.99, 0.06608}, {12.86, 0.078932}, {15.17, 0.155}, {16.17, 0.23144},
{17.41, 0.33438}, {18.33, 0.56514}, {19.37, 0.72128}, {20.40, 0.708946},
{22.15, 1.08536}, {23.16, 2.1296}, {24.01, 2.0304}, {25.22, 2.4478},
{27.52, 2.7564}, {28.27, 2.714}, {29.26, 2.9056}, {30.31, 3.4054},
{31.41, 3.9004}, {32.36, 4.914}, {33.36, 5.6692}, {34.29, 5.8266},
{36.18, 6.1494}, {38.19, 7.1194}, {39.98, 9.0246}, {42.08, 10.8542},
{44.39, 12.050}, {45.44, 10.7492}, {46.33, 13.342}, {47.38, 15.646},
{48.73, 17.126}, {51.08, 13.2466}, {52.15, 14.938}, {53.09, 17.660},
{55.10, 19.030}, {56.44, 20.272}, {57.45, 17.346}, {59.58, 17.510},
{61.79, 18.790}, {63.82, 18.518}, {67.01, 19.186}, {67.98, 21.640},
{70.17, 18.446}};

ListPlot[data, PlotLabel -> "Time vs. Volume", Frame -> True,
FrameLabel -> {"Time", "Volume"}] We see that the variability increases with increasing time and/or volume. Sometimes considering a log scale for the dependent variable will equalize the variability across the independent variable and if we are really lucky, we might also see a linear relationship.

ListLogPlot[data, PlotLabel -> "Time vs. Volume (log scale)",
Frame -> True, FrameLabel -> {"Time", "Volume"}] The variability seems to be equalized but we don't see a linear relationship. Maybe things are better if we also put time on a log scale:

ListLogLogPlot[data,
PlotLabel -> "Time (log scale) vs. Volume (log scale)",
Frame -> True, FrameLabel -> {"Time", "Volume"}] This is better (in terms of approach a linear relationship) but maybe not so great. We use LinearModelFit to fit 3 candidate models:

(* Log[volume] = a + b*time + error *)
lm1 = LinearModelFit[Transpose[{data[[All, 1]], Log[data[[All, 2]]]}], time, time];
lm1 // Normal
(* -3.6823257448651945 + 0.1240528889265737 time *)

(* Log[volume] = a + b*Log[time] + error *)
lm2 = LinearModelFit[Transpose[{data[[All, 1]], Log[data[[All, 2]]]}], Log[time], time];
lm2 // Normal
(* -11.638867479884478 + 3.6691813988905664 Log[time] *)

(* Log[volume] = a + b*Log[Log[time]] + error *)
lm3 = LinearModelFit[Transpose[{data[[All, 1]], Log[data[[All, 2]]]}],Log[Log[time]], time];
lm3 // Normal
(* -11.91702195385438 + 10.627420293776636 Log[Log[time]] *)

(* AICc values *)
{lm1["AICc"], lm2["AICc"], lm3["AICc"]}
(* {162.27980726580472, 62.96167478350239, 38.01345120554676} *)


We see that model 3 has a much, much smaller AICc value. (Differences greater than 4 are generally considered large.) But none of the models fit real well if we consider the fit at larger values of time and the patterns that still remain when looking at the residuals. Here are the predictions both on the original scale and on a log scale for both variables:  Again, not great fits. While model 1 (Log[Volume] = a + b*Time + error) has a constant "time to doubling", the other two better (but not great) fits have the doubling time dependent on time. That (and the way the raw data looks) suggests that maybe the doubling time isn't a good summary statistic.

There's also the issue about if the data is from a single tumor (which makes inferences to all similar tumors problematic at best) or if the data is a mixure of different tumors but some of the measurements being on the same tumor. That would require a "repeated measures" analysis to account for the correlation among observations.

• very nice exposition...'all models are wrong but some are useful...' (and some are dangerous). This is a both a great answer and an instructive sermon. :) – ubpdqn Nov 4 '16 at 22:55

An exponential growth approximation:

vt = {{4.6, 0.0016308}, {5.7, 0.0032148}, {6.7,
0.005614}, {7.9, 0.0118598}, {8.8, 0.02015}, {9.8,
0.027538}, {11., 0.034546}, {12., 0.06608}, {12.9,
0.078932}, {15.2, 0.155}};
fit = Normal@LinearModelFit[{#1, Log@#2} & @@@ vt, t, t]
func[u_] := Exp[fit] /. t -> u
dt = s /. First@Quiet[Solve[func[s]/func == 2, s]]


The doubling time is about 1.6 days.

Plot[Evaluate@func[u], {u, 0, 15}, Epilog -> {Red, Point[vt]},
GridLines -> Transpose[Table[{dt j, func[dt j]}, {j, 0, 10}]],
GridLinesStyle -> Lighter[Green, 0.9], Frame -> True,
Background -> Lighter[Orange, 0.8],
PlotLabel -> Row[{"Doubling Time: ", Round[dt, 0.01], " days"}]] • If I add all data: sites.google.com/site/lovroshr/Home/… I get resault eqaul 5,58. Why? – SKZagreb Nov 4 '16 at 8:55
• @SKZagreb perhaps you can adapt to your full dataset. I may have copied numbers in error as they were not provided in a easy to copy format. I suggest you play with you full dataset, esp plot. Either edit Q after you play or ask another. Good luck:) – ubpdqn Nov 4 '16 at 9:00