I am using the nls SSlogis function in R to make a model expressing water absorption in a plant, where y=water absorption (g per m^2), and x=minutes in water. For a given y value (in this case max water absorption), I would like to solve for x (the minute we reach peak absorption) using each model (I have a few species each with an individual model).
I have tried the uniroot() function, but I seem to be doing it wrong:
mod1_roots <- uniroot(mod1, lower=0, upper=600, y=max_y_mod1)
where lower and upper are the range of minutes, and mod1 is the SSlogis model in question
The error message is: Error in f(lower, ...) : could not find function "f"
So I assume I am not using the "function" part correctly and it should be something other than the model. Ugh.
Can anyone help a clueless botanist out? Thanks friends!
Edit for reproducibility (I hope):
Here's some real data
absorption <- c(297.0470936,262.809483,323.8243166,296.6731868,313.5985664,283.1004567,259.8724386,228.8903642,197.1585476,230.1674857,182.5799195,148.0262402,134.087096,77.98206413)
minutes <- c(195,181,167,157,147,135,105,83,63,45,33,24,10)
cembra <- as.data.frame(cbind(absorption,minutes))
cembra_mod <- nls(absorption ~ SSlogis(minutes, Asym, xmid, scal), cembra)
My goal is to predict the minutes at which absorption = 100 (or any specified number). Thanks!!