nlrob and robust nonlinear regression with upper and/or lower bounds on parameters
On 2013-03-15 07:57, Shane McMahon wrote:
I have a question regarding robust nonlinear regression with nlrob. I would like to place lower bounds on the parameters, but when I call nlrob with limits it returns the following error: "Error in psi(resid/Scale, ...) : unused argument(s) (lower = list(Asym = 1, mid = 1, scal = 1))" After consulting the documentation I noticed that upper and lower are not listed as parameter in the nlrob help documentation. I haven't checked the source to confirm this yet, but I infer that nlrob simply doesn't support upper and lower bounds. For my current problem, I only require that the parameters be positive, so I simply rewrote the formula to be a function of the absolute value of the parameter. However, I have other problems where I am not so lucky. Are there robust nonlinear regression methods that support upper and lower bounds? Or am I simply missing something with nlrob? I've included example code that should illustrate the issue. require(stats) require(robustbase) Dat <- NULL; Dat$x <- rep(1:25, 20) set.seed(1) Dat$y <- SSlogis(Dat$x, 10, 12, 2)*rnorm(500, 1, 0.1) plot(Dat) Dat.nls <- nls(y ~ SSlogis(x, Asym, mid, scal), data=Dat,start=list(Asym=1,mid=1,scal=1),lower=list(Asym=1,mid=1,scal=1)); Dat.nls lines(1:25, predict(Dat.nls, newdata=list(x=1:25)), col=1) Dat.nlrob <- nlrob(y ~ SSlogis(x, Asym, mid, scal), data=Dat,start=list(Asym=1,mid=1,scal=1)); Dat.nlrob lines(1:25, predict(Dat.nlrob, newdata=list(x=1:25)), col=2) Dat.nlrob <- nlrob(y ~ SSlogis(x, Asym, mid, scal), data=Dat,start=list(Asym=1,mid=1,scal=1),lower=list(Asym=1,mid=1,scal=1)); Dat.nlrob thanks, Shane
I'm not sure what your example is supposed to illustrate, but the "lower" argument in nls() is being ignored. As ?nls says: 'Bounds can only be used with the "port" algorithm', which is not the default, and nls() does issue a warning with your code. If you want to force a coefficient to be positive, the usual approach is to estimate the logarithm of the coefficient by using the exp(log(coef)) construct. See argument 'lrc' in ?SSasymp for example. Introducing a shift to accommodate coef > k for given k is simple. Peter Ehlers