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: set constraints for coefficients of independents in regression


From   Austin Nichols <[email protected]>
To   [email protected]
Subject   Re: st: set constraints for coefficients of independents in regression
Date   Thu, 2 Jun 2011 16:56:28 -0400

Zhi Su <[email protected]> :
Use local macros, not variables containing constants:
sysuse auto,clear
reg price weight turn displacement length
loc 1= _b[weight]
loc 2= _b[turn]
loc 3= _b[displacement]
loc 4= _b[length]
constraint def 1 weight = `1'
constraint def 2 turn = `2'
constraint def 3 displacement = `3'
constraint def 4 length = `4'
cnsreg price mpg weight turn displacement length gear_ratio, c(1/4)
reg price mpg weight turn displacement length gear_ratio
test (weight=`1') (turn=`2') (displacement=`3') (length=`4'), coef


On Thu, Jun 2, 2011 at 2:00 PM, John Antonakis <[email protected]> wrote:
> Oops....I thought Zhi wanted to test a constraint.....though, after the
> -test- command I give you if you add - , coef- you'll get the same
> coefficients as in the constrained regression that Kit demonstrated, i.e.,
>
> test (x1=4) (x2=19) (x3=2) (x4=8) , coef
>
> Out of interest Zhi, what do you intend to do next with your model?
*
*   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