# How does one build/find a mathematical model for a convex relationship?

I think my various questions on this site about spline and polynomial regression boil down to this:

I have many datasets to analyze where individuals grow over time and, depending on treatment group, either plateau out or decline. Reporting that the "shapes of the curves are significantly different" won't cut it, because to the casual observer that begs the question "in what way, and by how much", and I think the casual observer is right.

What strategy should I follow in modifying that model to accommodate both peaking and plateauing groups? The ones that follow a plateau trajectory can probably be fit by a simple logistic model. For the growth-and-decline groups, is it a matter of fitting a weighted sum of an increasing and a decreasing logistic function? For example, in R or Splus nls(y~a1*SSlogis(b1,b2,b3,b4)-a2*SSlogis(b5,b6,b7,b8)) (using that just an example, this is not intended as solely an R-specific question).

More importantly, I don't want to reinvent the wheel. Curves with maxima and/or minima are such a common problem in biology, I'm sure there must be an established model for this case, I just don't know the correct name to search for. So, I'm hoping someone can point me in the right direction.

PS: polynomials and splines seem to offer only a black-box approach; I'm looking for a model parametrized in a way that's interpretable and gives some insight into underlying mechanisms-- "e.g.: this coefficient is positive, therefore this treatment group's curve is shifted to the right of the control group's". That's supposed to be the forte of nonlinear models, but every example I can find is about non-decreasing or non-increasing trends.

If you're content to fit a quadratic regression, then you could use $lm$ with the formula y ~ 1 + x + I(x^2). You can reinterpret the coefficients by completing the square: if you put your quadratic in the form $y \approx s(x - p)^2 + e$, the parameters have a simple intepretation.

• $p$ is for (p)eak
• $s$ is for (s)cale
• $e$ is for (e)levation of the peak above the $x$ axis.

Any quadratic can be put in this form. Starting from $ax^2 + bx + c$,

• Set $s=a$.
• Solve $-2sp = b$, i.e. $p = -b/2a$.
• Solve $e + p^2 = c$, i.e. $e = c - (b^2/4a^2)$.

### Uncertainty quantification for transformed parameters

Readers of this question may also wish to construct confidence intervals for the transformed parameters. Suppose that the $lm$ call estimates a 3x3 covariance matrix $\Sigma$ for the estimates of $a, b, c$. (Usually, 95% confidence intervals would be constructed with a margin of error roughly twice the standard error, which is $\pm 2\sqrt{\Sigma_{ii}}$ in my notation.)

You can use the multivariate delta rule to convert $\Sigma$ into an estimate for the covariance of the (p,s,e) parameters: compute $J\Sigma J^T$, where $J$ is the matrix of partial derivatives of (p,s,e) with respect to (a,b,c). These partials are (somebody please check my calculus):

• for p: [$b/2a^2$, $-1/2a$, $0$]
• for s: [1, 0, 0]
• for e: [$2b^2/4a^3$,$-1/4a^2$,1]

Once you have $C = J\Sigma J^T$, compute the approximate MOE for a 95% CI as $\pm 2\sqrt{C_{ii}}$, where $i$ is 1 for $p$, 2 for $s$, 3 for $e$.

• This answer does not address the plateauing case in the question. That case is more difficult because the magical property of quadratics -- a shift-invariant family emerging as linear combinations of three basis functions $1, x, x^2$ -- does not extend to plateauing families such as logistic curves. I will ponder this and edit accordingly. – eric_kernfeld Oct 4 '17 at 14:41
• Also, this approach has strong assumptions: quadratic trend, thin-tailed errors, constant error variance, and independent observations. – eric_kernfeld Oct 4 '17 at 22:06