Bookmark and Share

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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: Bounded Inequality Constraints


From   Dmitriy Glumov <[email protected]>
To   [email protected]
Subject   Re: st: RE: Bounded Inequality Constraints
Date   Wed, 7 Dec 2011 10:09:01 -0500

Al, Nick, and Cam,

Thank you very much for your help, for showing how to re-parametrize
the model, as well as for providing additional literature on the
topic. In regards to Steve's question, the model itself is looking at
the ratio of purchases and sales of commercial properties (with
different combinations of property type and region serving as
independent variables); because the transction can't occur once the
ratio of the coefficient falls below 2.5 or goes above 5, I wanted to
add such constraints. Again, thank you for everyone's help and for the
valuable suggestions.

Dmitriy

On Tue, Dec 6, 2011 at 6:18 PM, Steve Samuels <[email protected]> wrote:
>
> I also could not get Dmitriy's original auto  problem to converge. In the absence of other software, I'd suggest a grid search for the minimum sum of squares.
>
>
> Visualizing the problem geometrically, it's easy to see the following: in the one-predictor case, if the least squares estimate is outside the required bounds, the constrained estimate will be the value of the nearest boundary point. But with the two (or more) predictors, if the LS estimates are correlated and one satisfies the inequalities, its constrained value still could be forced to a boundary point.
>
>
> I'd like to know what kind of problem  Dmitriy has that bounds so many parameters.
>
>
> Steve
> [email protected]
>
>
> On Dec 6, 2011, at 10:19 AM, Feiveson, Alan H. (JSC-SK311) wrote:
>
> oops! - misplaced parentheses messed it up - this is correct for the "cheating" verison:
>
>
> . nl  (price = {A=14500} + (2+3*invlogit( {c1=-.187} ) )*weight   + (-100+30*invlogit( {c2=-.24} ) )*mpg     +   (-120+30*invlog
>> it( {c3=0} ) )*length                           )
> (obs = 74)
>
> Iteration 0:  residual SS =  4.15e+08
> Iteration 1:  residual SS =  4.08e+08
> Iteration 2:  residual SS =  4.08e+08
> Iteration 3:  residual SS =  4.08e+08
> Iteration 4:  residual SS =  4.08e+08
> Iteration 5:  residual SS =  4.08e+08
> Iteration 6:  residual SS =  4.08e+08
> Iteration 7:  residual SS =  4.08e+08
>
>     Source |       SS       df       MS
> -------------+------------------------------         Number of obs =        74
>      Model |   226957412     3  75652470.6         R-squared     =    0.3574
>   Residual |   408107984    70  5830114.06         Adj R-squared =    0.3298
> -------------+------------------------------         Root MSE      =  2414.563
>      Total |   635065396    73  8699525.97         Res. dev.     =  1358.703
>
> ------------------------------------------------------------------------------
>      price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>         /A |   14542.44   5890.631     2.47   0.016     2793.944    26290.93
>        /c1 |   1.314505   2.331609     0.56   0.575    -3.335742    5.964753
>        /c2 |  -.2397128     11.354    -0.02   0.983    -22.88456    22.40513
>        /c3 |   .0175751   5.296615     0.00   0.997    -10.54619    10.58134
> ------------------------------------------------------------------------------
>  Parameter A taken as constant term in model & ANOVA table
> . di (2+3*invlogit( 1.314505 ) )
> 4.3647981
>
> . di (-100+30*invlogit( -.2397128) )
> -86.789286
>
> . di (-120+30*invlogit( -.2397128) )
> -106.78929
>
> (in other words, I get back the OLS estimates)
>
>
>
> With more realistic constraints, this has some promise of working.
>
> Al
>
>
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Feiveson, Alan H. (JSC-SK311)
> Sent: Tuesday, December 06, 2011 9:02 AM
> To: [email protected]
> Subject: RE: st: RE: Bounded Inequality Constraints
>
> Dmitriy, Nick   -
>
> Sorry, but I think I "solved" the problem "backwards" in the sense that my parameters c1, c2, c3 lie in the required bounds, but not the coefficients of weight, mpg and length, which are the transformed parameters.
>
> I tried doing it the other way, to constrain the coefficients; e.g.
>
> nl  (price = {A=14500} + (2+3*invlogit( {c1=-.187} )*weight )  + (-100+30*invlogit( {c2=-.24} )*mpg )    +   (-120+30*invlogit( {c3=0} )*length )                          )
>
>
> but I get garbage, even when I cheated and modified the constraints so that the coefficients are in the range of what you get with OLS.
>
>
> OLS results:
> . reg price weight mpg length
>
>     Source |       SS       df       MS              Number of obs =      74
> -------------+------------------------------           F(  3,    70) =   12.98
>      Model |   226957412     3  75652470.6           Prob > F      =  0.0000
>   Residual |   408107984    70  5830114.06           R-squared     =  0.3574
> -------------+------------------------------           Adj R-squared =  0.3298
>      Total |   635065396    73  8699525.97           Root MSE      =  2414.6
>
> ------------------------------------------------------------------------------
>      price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
> -------------+----------------------------------------------------------------
>     weight |   4.364798   1.167455     3.74   0.000     2.036383    6.693213
>        mpg |  -86.78928   83.94335    -1.03   0.305     -254.209    80.63046
>     length |  -104.8682   39.72154    -2.64   0.010    -184.0903   -25.64607
>      _cons |   14542.43   5890.632     2.47   0.016      2793.94    26290.93
> ------------------------------------------------------------------------------
>
>
> So I constrained the coefficient for mpg to lie between -100 and -70, and the coefficent for length to lie between -120 and -90. The initial values are what transforms to the OLS estimates. Still I get convergence problems.
>
> Al
>
>
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On Behalf Of Dmitriy Glumov
> Sent: Tuesday, December 06, 2011 7:52 AM
> To: [email protected]
> Subject: Re: st: RE: Bounded Inequality Constraints
>
> Al,
>
> Thank you very much for showing the tranformation, this is very
> helpful. However, I have some trouble understanding the values you
> chose in the transformation (I apologize for using a bad example), so
> would it be possible for you to briefly go over them. In particular
> would this transformation account for the upper bound of 5, if the
> coefficients were to go that far? Again, thank you for the help and
> consideration.
>
> Dmitriy
>
> On Mon, Dec 5, 2011 at 12:09 PM, Feiveson, Alan H. (JSC-SK311)
> <[email protected]> wrote:
>> Dmitriy - The example from the auto data doesn't work very well, but if you want to crank it out by brute force, you could use nonlinear least squares with a logit transformation:
>>
>> nl  (price = {A} + logit( ( {c1=3.5}-2)/3) * weight  + logit( ( {c2=3.5}-2)/3) * mpg   +   logit( ( {c3=3.5}-2)/3) * length  )
>>
>>
>>
>>     Source |       SS       df       MS
>> -------------+------------------------------         Number of obs =        74
>>       Model | -2.6420e+09     3  -880670066         R-squared     =   -4.1602
>>    Residual |  3.2771e+09    70  46815365.6         Adj R-squared =   -4.3814
>> -------------+------------------------------         Root MSE      =  6842.176
>>       Total |   635065396    73  8699525.97         Res. dev.     =  1512.858
>>
>> ------------------------------------------------------------------------------
>>       price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
>> -------------+----------------------------------------------------------------
>>          /A |   1677.936   5890.632     0.28   0.777    -10070.56    13426.43
>>         /c1 |   3.870228    .822251     4.71   0.000       2.2303    5.510156
>>         /c2 |   2.000028   .0023649   845.71   0.000     1.995311    2.004744
>>         /c3 |   2.000001   .0000529 37836.18   0.000     1.999896    2.000106
>> ------------------------------------------------------------------------------
>>  Parameter A taken as constant term in model & ANOVA table
>>
>>
>>
>> The coefficients c2 and c2 are estimated at their lowest allowable value (2.0) because they are negative in the unrestricted model. In this example, I didn't try to restrict the constant term ("A").
>>
>> Al Feiveson
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: [email protected] [mailto:[email protected]] On Behalf Of Dmitriy Glumov
>> Sent: Monday, December 05, 2011 8:21 AM
>> To: [email protected]
>> Subject: st: Bounded Inequality Constraints
>>
>> Dear Statalist Users,
>>
>> I need to include inequality constraints into the regression I am
>> working on. In particular, I would like the coefficients of all the
>> independent variables to be between 2.5 and 5. To provide you with an
>> example, suppose I was using an Auto dataset and running the following
>> simple regression:
>>
>> regress price mpg weight length
>>
>> This regression needs to be constrained in such a way so that the
>> coefficients for mpg, weight, and length all stay bounded between 2.5
>> and 5 (and disregarded if they are outside this range). I know there
>> has been a fair amount of discussion in regards to this topic and
>> Maarten has posted this solution
>> (http://www.stata.com/support/faqs/stat/intconst.html), but I wasn't
>> sure if there's potentially an another, perhaps more appropriate way,
>> to solve the problem I am dealing with - one that requires bounding
>> (rather than a one-sided inequality). Moreover, I could not figure out
>> how to transform the solution that Maarten posted into the one where
>> both bounds are accounted for. Hence, any help with this would be
>> greatly appreciated. Thank you for your consideration.
>>
>> Regards,
>> Dmitriy
>> *
>> *   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/
>
> *
> *   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/
>
> *
> *   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/

*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index