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

# RE: st: Fitting a linear regression where coefficients are bounded proportions

 From Timothy Mak To "statalist@hsphsun2.harvard.edu" Subject RE: st: Fitting a linear regression where coefficients are bounded proportions Date Thu, 12 Dec 2013 13:55:11 +0800

```Stata is not really built for inequality constrained optimization. There are much better software for this, e.g. Matlab with optimization toolbox.

Tim

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox
Sent: 12 December 2013 03:36
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: Fitting a linear regression where coefficients are bounded proportions

I am thinking from a statistical point of view, with first axiom that
data are messy. My #2 really meant "getting it to fit in a way that
satisfies you".

I don't understand your difficulty in coding this as the principles
are laid out in a FAQ, but at the same time I am not volunteering
code.
Nick
njcoxstata@gmail.com

On 11 December 2013 19:27, Martin Trombetta <martintrombetta@gmail.com> wrote:
> Yes, it can be done, Nick. The problem is quite straightforward from a
> mathematical point of view. The objective function is quadratic and
> the constraints are linear.
>
> Besides, think about it this way: imagine we only have two regressors.
> Since parameters must be proportions, we might as well call them b and
> 1-b. All my inequality constraints say is that not all combinations of
> b and 1-b are acceptable, only those that belong to a specific subset.
> In that specific subset, there must be one combination that minimizes
> the sum of square residuals and that is the one I want.
>
> The problem is that I have 9 regressors instead of 2. I have
> considered the possibility of using the multinomial logit approach,
> but then I cannot guarantee that the inequality constraints will be
> satisfied. Alternatively, I could use (appropriately defined)
> individual logits for each coefficient, but then they would not sum to
> one. I need an approach that guarantees both things.
>
> 2013/12/11 Nick Cox <njcoxstata@gmail.com>:
>> Interval constraints are handled by reparameterisation; the logit is
>>
>> Constraints on parameter totals by one being total - sum of others.
>>
>> Your regression sounds so constrained that I wonder whether
>>
>> 1. You need data at all.
>>
>> 2. You have a real chance of getting it to fit.
>>
>> Nick
>> njcoxstata@gmail.com
>>
>>
>> On 11 December 2013 19:00, Martin Trombetta <martintrombetta@gmail.com> wrote:
>>> Thanks Maarten, I had read this post before and, even though it was
>>> useful at first, I think the methods suggested there do not quite help
>>> with my particular problem. Please notice that I wish to include both
>>> an equality constraint and several inequality constraints in the same
>>> problem, I do not see how to use the methods from this post.
>>>
>>> 2013/12/11 Maarten Buis <maartenlbuis@gmail.com>:
>>>> On Tue, Dec 10, 2013 at 7:50 PM, Martin Trombetta wrote:
>>>>> I need to fit a linear regression where coefficients are to be
>>>>> interpreted as proportions (that is, they must sum to 1), but at the
>>>>> same time I wish to impose inequality constraints on each of them:
>>>>> they all should belong to a specific interval (a,b) inside the unit
>>>>> interval.
>>>>
>>>> There is a discussion of how to do that here:
>>>> http://www.stata.com/support/faqs/statistics/linear-regression-with-interval-constraints/
>>>>
>>>> Hope this helps,
>>>> Maarten
>>>>
>>>> ---------------------------------
>>>> Maarten L. Buis
>>>> WZB
>>>> Reichpietschufer 50
>>>> 10785 Berlin
>>>> Germany
>>>>
>>>> http://www.maartenbuis.nl
>>>> ---------------------------------
>>>> *
>>>> *   For searches and help try:
>>>> *   http://www.stata.com/help.cgi?search
>>>> *   http://www.stata.com/support/faqs/resources/statalist-faq/
>>>> *   http://www.ats.ucla.edu/stat/stata/
>>>
>>>
>>>
>>> --
>>> Martin Trombetta
>>> *
>>> *   For searches and help try:
>>> *   http://www.stata.com/help.cgi?search
>>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
>> *   http://www.ats.ucla.edu/stat/stata/
>
>
>
> --
> Martin Trombetta
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```