Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# RE: st: Constrained linear regression... is not linear?

 From kokootchke To statalist Subject RE: st: Constrained linear regression... is not linear? Date Mon, 6 Dec 2010 20:30:57 -0500

```Something that could perhaps help understanding what's going on (although I don't exactly see how) is that y is a discrete variable, y = {1, 2, 3, 4, 5}...
Thanks...

----------------------------------------
> From: kokootchke@hotmail.com
> To: statalist@hsphsun2.harvard.edu
> Subject: st: Constrained linear regression... is not linear?
> Date: Mon, 6 Dec 2010 20:17:11 -0500
>
> Hello!
> I am trying to run the following constrained linear regression:
> y = ax + (1-a)z, with a in [0,1]
> I am using the cnsreg command, which I've used before but now it's giving me error r(131) (not possible with test), which I never saw before. I did a search for this error and it says it happens when the regression is non-linear... but I don't understand what is non-linear about my constraints or my regression.
> What I'm doing is the following:
> constraint define 1 x+z = 1constraint define 2 x>=0constraint define 3 x<=1
> cnsreg y x z, c(1-3)
> But this doesn't work.
> If I run the regression only using constraint 1, the regression does run but it gives me a coefficient for x which is outside of [0,1]... but I don't want this. Does it mean that there's no solution with the three restrictions in place?
> I'm using Stata v10.
> I appreciate any suggestions. Thanks in advance.Adrian
>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```