I am working with concentration over time data. The intent is to find a model for the decay rate of the phenol content of algae over time. Not much info is available on the literature about the shape of decay of these phenols, but my data showed a linear decay for one species and one non-linear for another species (see scatterplots below).
I want to use a decay function of the type: y = ae^kt, where y is the final concentration at time t, a is the initial concentration, and k is the decay constant. This is what I believe is theoretically the correct function to use for the 'Carpo' species, since phenols are degrading over time in an exponential fashion (see graph)
Here is my data for Carpo spp:
structure(list(Time = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 72, 72, 72, 72, 72,
72, 72, 72, 72, 72, 72, 72, 168, 168, 168, 168, 168, 168, 168,
168, 168, 168, 168, 168), Phenols = c(155.05396358031, 292.448819046919,
392.09254588543, 373.777907851168, 158.870919593217, 227.401160002983,
158.545124752453, 348.038178016855, 196.004621459891, 198.711112888521,
214.843845072805, 125.476444729792, 115.269817901552, 50.5754768174938,
182.514953753076, 413.728300560148, 90.3366033152076, 116.823625331981,
145.874402114001, 18.4955652722213, 52.868657898569, 130.266434542432,
164.41413201994, 73.7144602576443, 15.0853972561612, 37.200244360702,
32.0793538786566, 27.2060777211984, 26.4422227157876, 25.2930201395159,
30.7405411687273, 9.67833536375294, 19.8968659319271, 28.3441845349511,
18.9431364122308, 25.34674890162, 3.72857179653475, 10.5561871026197,
14.1864805110413, 0.521827126052154, 7.4465801315315, 6.77057861607754,
2.26713632376336, -1.90266594684443, 3.61534055996961, 3.42587396256444,
3.12017043262619, 2.30896861408144)), row.names = c(NA, -48L), class = c("tbl_df",
"tbl", "data.frame"))
That gives this scatterplot:
Carpo spp phenol concentration over time
The Macro spp has this scatterplot- just for reference:
Macro spp phenol concentration over time, with fitten linear regression (y ~ x)
So what I am trying to do, is to find line of best fit + 95% CI for the Carpo data, with a line of the type y = ae^kt. The only way I have thought of to do this so far, is by log-transforming the data and fitting a linear regression (with abs values of phenols as some negative values/zeros exist):
ggplot(Carpo.exp.data, aes(x=log(Time), y=log(abs(Phenols))))+
geom_point()+
theme_minimal()+
geom_smooth(method = "lm")
which gives this: log-transformed concentration of phenols over time (Carpo spp)
To look at the coefficient estimates I fit a linear model and look at the summary (excluding the first 12 rows of data, as Time = 0, which produces an error for the log conversion):
> m1<-lm(log(abs(Phenols))~log(Time), Carpo.exp.data[13:46,])
> summary(m1)
Call:
lm(formula = log(abs(Phenols)) ~ log(Time), data = Carpo.exp.data[13:46,
])
Residuals:
Min 1Q Median 3Q Max
-2.1706 -0.2753 0.1180 0.4235 1.3116
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.9291 0.6810 14.58 1.10e-15 ***
log(Time) -1.6411 0.1617 -10.15 1.57e-11 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Residual standard error: 0.7411 on 32 degrees of freedom
Multiple R-squared: 0.763, Adjusted R-squared: 0.7556
F-statistic: 103 on 1 and 32 DF, p-value: 1.571e-11
But now I feel like I am stuck at this stage and cannot figure out how to go from this linear model back to the exponential decay using the non-transformed data, as I want:
- the estimated decay rates (k) from my data,
- a graph with the non-transformed data overlayed with the exponential decay curve derived from the log trasnformed lm coefficients.
Does this make sense? Can someone help me out? Thank you - and sorry in advance if I have forgotten to include something.