[R] Constrained fits: y~a+b*x-c*x^2, with a,b,c >=0

Alex van der Spek amvds at xs4all.nl
Wed May 27 11:51:39 CEST 2009

I wonder whether R has methods for constrained fitting of linear models.

I am trying fm<-lm(y~x+I(x^2), data=dat) which most of the time gives
indeed the coefficients of an inverted parabola. I know in advance that
it has to be an inverted parabola with the maximum constrained to
positive (or zero) values of x.

The help pages for lm do not contain any info on constrained fitting.

Does anyone know how to?

Alex van der Spek

More information about the R-help mailing list