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: Constrained Logistic/Probit Regression
From
Jorge Eduardo Pérez Pérez <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Constrained Logistic/Probit Regression
Date
Fri, 15 Nov 2013 23:18:07 -0500
Stata 13's -mlexp- command makes this incredibly easy.
sysuse auto, clear
* Logit
logit foreign weight mpg
* Logit with mlexp
generate q = 2*foreign - 1
global qxb "q*({b1}*weight + {b2}*mpg + {b0})"
mlexp (ln(invlogit($qxb)))
* Now constrain the coefficient of mpg to be larger than weight
* To do this, we add an exponential term to the coefficient of weight
global qxb "q*({b1}*weight + ({b1}+exp({b2}))*mpg + {b0})"
mlexp (ln(invlogit($qxb)))
* Display coefs and std. errors.
nlcom (b1: [b1]_cons) (b2: [b1]_cons +exp([b2]_cons)) (b0: [b0]_cons)
To see how this works, check Roberto Ferrer's link works for linear
regression, and:
http://www.stata.com/support/faqs/statistics/regression-with-interval-constraints/
And then look at example 4 in the manual entry for -mlexp-.
Hope this helps,
--------------------------------------------
Jorge Eduardo Pérez Pérez
Graduate Student
Department of Economics
Brown University
On Fri, Nov 15, 2013 at 10:27 PM, Roberto Ferrer <[email protected]> wrote:
> Check this:
>
> http://www.stata.com/support/faqs/statistics/linear-regression-with-interval-constraints/
>
> On Fri, Nov 15, 2013 at 5:22 PM, Oscar Wilde <[email protected]> wrote:
>> Hello;
>> I have a logistic regression problem of the form
>>
>> y_0 = logit ( x_0, x_1, x_2)
>>
>> I would like to impose constraints
>>
>> x_0 > x_1
>> x_1 > x_2
>>
>> The model is a marketing response model with x_0, x_1, x_2 marketing activities at current time, last interval and two intervals .
>>
>> Is there a way i can do this in 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/
*
* 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/