0

I'm trying to fit an exponential decay curve to my data to measure copies of DNA left over time, with no luck.

Here is my dataframe: mydf <- data.frame(copies=c(603.3, 424.2, 523.6, 426.4, 331.2, 201, 115, 15.6, 1.424, 1.424, 2.138, 0), hours=c(0,1,3,5,12,24,48,96,168,336,504,720))

I get a singular gradient error when I try to run nlsfit(mydf, model=6, start=c(a=603.3,b=-1)), which I understand has to do with my start a and b values.

The formula for exponential decay I'm using is y ~ a*exp(b*x), where y is the copies and x is in hours (model 6). When I try to take the log of both sides to fit a linear model and get my a and b values, I keep getting an error. I'm sure it's a simple fix but I'm pretty new to this and any help finding these start values would be so appreciated!

The code I'm using to take the log of both sides is lm(log(copies) ~ log(hours), data=mydf).

Thanks in advance for any help!!

Mscbio
  • 1
  • 1
  • Of course you're getting an error, your data has zeros. But in any case, if you take logs of both variables, you're looking at a power relationship not an exponential decay – Glen_b Jul 27 '21 at 23:34

0 Answers0