[R] nlrob and robust nonlinear regression with upper and/or lower bounds on parameters
Peter Ehlers
ehlers at ucalgary.ca
Fri Mar 15 23:45:33 CET 2013
Forgot to mention: You might find the nlmrt package helpful but
I have no experience with that (yet).
Peter Ehlers
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
>
> ______________________________________________
> R-help at r-project.org 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.
>
More information about the R-help
mailing list