# Comparing difference between polynomial and linear regression (accumulation curves)

I have accumulation data and curve for two drugs, one follows linear regression, whereas the other may be described with polynomial model. (See the attached figure.) What is the correct method to compare them (ie. if there is significant difference between the two drug accumulation)?

mydata<-structure(list(Time = 1:10, Drug1 = c(3L, 3L, 4L, 5L, 6L, 8L, 9L, 10L, 12L, 13L), Drug2 = c(4L, 6L, 10L, 12L, 13L, 14L, 16L, 17L, 16L, 16L)), .Names = c("Time", "Drug1", "Drug2"), class = "data.frame", row.names = c(NA, -10L))
model_drug1<-lm(mydata$Drug1 ~ mydata$Time)
model_drug2<-lm(mydata$Drug2~mydata$Time+ I(mydata\$Time^2))

• I'm very skeptical whether a quadratic model is appropriate for drug accumulation. Usually you'd use a model that can describe saturation. Anyway, if you fit different models, you are already assuming a difference. I'm not sure what you want to test then. A significance tests would make sense if you fitted the same model. A GAM is sometimes useful for this. However, if you show this graph, no formal test should be required as the difference is obvious. Jan 8, 2018 at 11:19

I agree with the scepticism expressed by Roland in the comment to your question. A quadratic curve is probably not a very realistic model for drug accumulation.

You can test significance by combining the data and the models. Include an intercept for the difference between the groups, and it's significance can be interpreted.

library(tidyr)
library(dplyr)

long <- mydata %>% gather(drug, amount, Drug1, Drug2)
fit <- lm(amount ~ Time * drug, data = long)
summary(fit)


This fits a combined model. I left out the quadratic term. You could include that as well. In terms of significance, this shows that the drugs have a significantly different intercept, but the difference in slope is not significant.

Call:
lm(formula = amount ~ Time * drug, data = long)

Residuals:
Min       1Q   Median       3Q      Max
-2.56364 -0.55758  0.00606  1.03636  1.65455

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept)      0.7333     0.9057   0.810  0.42997
Time             1.1939     0.1460   8.180 4.15e-07 ***
drugDrug2        4.1333     1.2808   3.227  0.00527 **
Time:drugDrug2   0.1758     0.2064   0.851  0.40707
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.326 on 16 degrees of freedom
Multiple R-squared:  0.9347,    Adjusted R-squared:  0.9224
F-statistic: 76.32 on 3 and 16 DF,  p-value: 1.073e-09


This all depends on the chosen model. For example, if you include a quadratic term, things can work out differently. You should look into using a model that has a kind of "ceiling", logistic growth for example.

Also, if you're interested in growing your understanding, more flexibility and improving predictions, I recommend looking at (hierarchical) bayesian models with rstanarm for example.