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

# Re: st: Constrained regression question

 From Jorge Eduardo Pérez Pérez <[email protected]> To "[email protected]" <[email protected]> Subject Re: st: Constrained regression question Date Tue, 27 Mar 2012 23:55:44 -0400

```Actually, that would restrict each coefficient to be between 0 and 0.95 ...
_______________________
Jorge Eduardo Pérez Pérez

On Tue, Mar 27, 2012 at 11:51 PM, Perez Perez Jorge Eduardo
<[email protected]> wrote:
> You can modify example 6 of the FAQ you posted to restrict your
> coefficients to add up to 0.95 and to be between 0 and 1. Simply
> define the last coefficient as 0.95 times the coefficient, i.e, with
> three coefficients:
>
> a2 = 0.95*exp(t2)/(1+exp(t2)+exp(t3))
> a3 = 0.95*exp(t3)/(1+exp(t2)+exp(t3))
> a1 = 0.95/(1+exp(t2)+exp(t3))
>
> _______________________
> Jorge Eduardo Pérez Pérez
>
>
>
> On Tue, Mar 27, 2012 at 6:04 PM, John Pfaff <[email protected]> wrote:
>> Hello,
>>
>> I am curious if it is possible to use Stata to estimate a set of weights. My basic problem is the following:
>>
>> I have data on R_t for years t = 1988 to 2008
>> I have data on A_t for years t = 1977 to 2008
>>
>> I want to see how well I can approximate R_t using 11 lagged years of A_t. In other words, I want to estimate the weights w_s in the following equation:
>>
>> R_t = w0*A_t + w1*A_(t-1) + w2*A_(t-2) + ... + w11*A_(t-11)
>>
>> The catch is that I have two sets of restrictions:
>>
>> (1) For each w_s, 0 < w_s < 1.
>> (2) Also, w0 + w1 + ... + w11 = 0.95
>>
>> Simply running a simple regression fails, since restriction (1) is violated numerous times (lots of negative weights).
>>
>> I started at http://www.stata.com/support/faqs/stat/interval-constraints.html, which showed me how to satisfy restriction (1). But two problems arise:
>>
>> * The non-linear regression dropped 7 of the 11 A variables.
>> * I do not see any obvious way to impose restriction (2) when using invlogit.
>>
>> Is there a better way to accomplish this? Thank you for any assistance!
>>
>> John
>>
>>
>> *
>> *   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/
```