John McNeil
2007-Apr-17 17:36 UTC
[R] how to estimate dose from respond given drc package result
Dear all, I can use the very nice drc package (multdrc()) to model and plot a dataframe containing dose and response values. I can also use predict.drc() to yield response values given a dose. I need to do the opposite, estimate a dose given the response. The general predict documentation seems to say that this is possible, but it does not appear that predict.drc has that capability. This makes sense because it is easy to compute y values from x values, given the fitted equation, but it is hard to do the opposite. It seems that I need to do some kind of successive approximation. Is there a package that takes a multdrc generated model and estimates dose given response? Thank you all for your time, John
Gabor Grothendieck
2007-Apr-18 00:51 UTC
[R] how to estimate dose from respond given drc package result
Try this: library(drc) # get dose corresponding to response (y = 2) model1 <- multdrc(rootl ~ conc, data = ryegrass) f <- function(x, y) y - predict(model1, data.frame(conc = x))[1] uniroot(f, c(0, 10), y = 2) On 4/17/07, John McNeil <jam at xardas.com> wrote:> Dear all, > > I can use the very nice drc package (multdrc()) to model and plot a > dataframe containing dose and response values. I can also use > predict.drc() to yield response values given a dose. I need to do the > opposite, estimate a dose given the response. The general predict > documentation seems to say that this is possible, but it does not > appear that predict.drc has that capability. This makes sense because > it is easy to compute y values from x values, given the fitted > equation, but it is hard to do the opposite. > > It seems that I need to do some kind of successive approximation. Is > there a package that takes a multdrc generated model and estimates > dose given response? > > Thank you all for your time, > > John > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
John McNeil
2007-Apr-18 04:37 UTC
[R] how to estimate dose from respond given drc package result
Wow, thanks, that does it perfectly John On Apr 17, 2007, at 5:51 PM, Gabor Grothendieck wrote:> Try this: > > library(drc) > # get dose corresponding to response (y = 2) > model1 <- multdrc(rootl ~ conc, data = ryegrass) > f <- function(x, y) y - predict(model1, data.frame(conc = x))[1] > uniroot(f, c(0, 10), y = 2) > > > On 4/17/07, John McNeil <jam at xardas.com> wrote: >> Dear all, >> >> I can use the very nice drc package (multdrc()) to model and plot a >> dataframe containing dose and response values. I can also use >> predict.drc() to yield response values given a dose. I need to do the >> opposite, estimate a dose given the response. The general predict >> documentation seems to say that this is possible, but it does not >> appear that predict.drc has that capability. This makes sense because >> it is easy to compute y values from x values, given the fitted >> equation, but it is hard to do the opposite. >> >> It seems that I need to do some kind of successive approximation. Is >> there a package that takes a multdrc generated model and estimates >> dose given response? >> >> Thank you all for your time, >> >> John >> >> ______________________________________________ >> R-help at stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting- >> guide.html >> and provide commented, minimal, self-contained, reproducible code. >>