I\'m trying to calculate the doubling time of cells using a scatterplot. This is my dataframe
df = data.frame(\"x\" = 1:5, \"y\" = c(246, 667, 1715, 4867, 11694)
You can plot the points to show the exponential rise and then linearize the function by applying log2 to the y values. With that you can plot and do a linear fit:
df = data.frame("x" = 1:5, "y" = c(246, 667, 1715, 4867, 11694))
plot(df) # plot not displayed
plot(df$x, log2(df$y))
abline(lm(log2(y)~x,df))
lm(log2(y)~x,df)
#-------------------
Call:
lm(formula = log2(y) ~ x, data = df)
Coefficients:
(Intercept) x
6.563 1.401 #the x-coefficient is the slope of the line
#---------------------
log(2)/1.4
#[1] 0.4951051
Checking with the original (not-displayed plot that does look like a sensible estimate of doubling time. Be sure to cite this posting if this happens to be a homework problem.
If I were tasked with using the original graph, first draw an exponential curve by hand. I would then draw two horizontal lines at y= 2000 and y=4000 and then drop perpendicular lines from their intersections with the curve and read off the difference in x values on the horizontal axis.That is what I meant by my comment above that I "checked" the log2/x-coef value for sensibility.