-2

I want to estimate e50 e0 emax from emax model the equation is Y=E0 + ((DOSE * EMAX)/(DOSE + ED50)) I want to use default algorithm How can I estimate E0 EMAX and E50?

I found the example code is :

args(nls)
function (formula, data = parent.frame(), start, control = nls.control(),
algorithm = c("default", "plinear", "port"), trace = FALSE,
subset, weights, na.action, model = FALSE, lower = -Inf,
upper = Inf, ...)
NULL

Thanks

user35631
  • 39
  • 1
  • 7

1 Answers1

1

Your example data doesn't seem well named, so I'll pretend I didn't see it. Make a vector called dose that contains your dose information and a vector called Y that contains the Y variable. Obviously they should be the same length. I'll just use rnorm() for my example. Then just call nls with some reasonable start values. I'll just pick some out of the blue.

> dose <- rnorm(400)
> Y <- rnorm(400)
> nls(formula=Y~e0+((dose*emax)/(dose+ed50)),start=c(e0=1,emax=10,ed50=2))
Nonlinear regression model
  model: Y ~ e0 + ((dose * emax)/(dose + ed50))
   data: parent.frame()
      e0     emax     ed50 
0.036105 0.005475 1.991276 
 residual sum-of-squares: 373.8

Number of iterations to convergence: 21 
Achieved convergence tolerance: 9.759e-06
farnsy
  • 2,282
  • 19
  • 22
  • thanks for your answer, but may i know why e0=1,emax=10,ed50=2? how did you choose those values – user35631 Aug 18 '14 at 01:29
  • They were the first random numbers that popped into my head. You could use all zeros if you wanted. Initial values don't matter if the problem is well-behaved. Even so, use something close to where you think it will end up if you can...or use zero or something else. You just have to give it *something*. – farnsy Aug 18 '14 at 01:32
  • how come when i try this the function does not work? nls(formula=Y~e0+((dose^h*emax)/(dose^h+ed50)),start=c(e0=1,emax=10,ed50=2,h=2)) thanks – user35631 Aug 18 '14 at 02:09
  • Don't know. Try posting the output R gives you when you try as well as part, at least, of the Y and dose vectors. You can get a postable output using the `dput()` command. – farnsy Aug 18 '14 at 02:53
  • The response are multiple:one is this Error in nls(formula = Y ~ e0 + ((dose^h * emax)/(dose^h + ed50)), start = c(e0 = 100, : number of iterations exceeded maximum of 50 another one is this Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at initial parameter estimates The code is this nls(formula=Y~e0+ ((dose^h*emax)/(dose^h+ed50)),start=c(e0=100,emax=100,ed50=20,h=10)) Y is too long but my dose is this dose <- c(rep(5,30),rep(25,30),rep(100,30),rep(250,30)) – user35631 Aug 18 '14 at 10:47
  • You might need to try a bunch of other starting points until you find one that works--or maybe just allow more iterations. Your objective function looks a little bit nasty to me so the optimization is not trivial. – farnsy Aug 18 '14 at 17:02