# [R] Multiple linear regression

Simon Wood snw at mcs.st-and.ac.uk
Thu Apr 19 12:54:27 CEST 2001

```> Dear R-users,
> I've a question regardiing multiple linear regression.
> Is it possible to regress a function of the type
> y=b0+b1*x1+b2*x2
> constraining the partial derivatives dy/dx1 and dy/dx2 to be greater
> than 0 ???

For low dimensional things like the example the easiest approach is to
recognise that the solutions has to be one of:
y=b0+b1*x1+b2*x2
y=b0+b1*x1 (b2=0)
y=b0+b2*x2 (b1=0)
y=b0       (b1=b2=0)

So you simply pick the one with the lowest RSS that satisfies b1>=0, b2>=0
(assuming you don't require strict inequality). For bigger problems, where
the expressions for the partials are not so simple, use quadratic
programming.

Simon

______________________________________________________________________
> Simon Wood  snw at st-and.ac.uk  http://www.ruwpa.st-and.ac.uk/simon.html
> The Mathematical Institute, North Haugh, St. Andrews, Fife KY16 9SS UK
> Direct telephone: (0)1334 463799          Indirect fax: (0)1334 463748

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```