Dan -
You can do this with a nonlinear least squares program that has the
constraint built in. Here's an example of this assuming your model is Ey =
b0 + b1*x1 + b2*x2 + z*x3:
= = = = = = = = = = = = = = = = = = = = = = = = = =
program define nlbz
if "`1'" == "?" {
global S_1 " B1 B2 Z"
version 7.0
/* get first guesses by ignoring the constraint */
reg `2' x1 x2 x3
matrix b = e(b)
global B1=b[1,1]
global B2=b[1,2]
global Z=b[1,3]
exit
}
global B0=-$B1*$Z
replace `1' = $B0 + $B1*x1 +$B2*x2 + $Z*x3
end
= = = = = = = = = = = = = = = = = = = = = = = = = =
Assuming you have the variables y, x1, x2 and x3 in your data set, you run
this by the command
nl bz y y
(repeat y twice in the calling sequence)
Al Feiveson
-----Original Message-----
From: Simundza, Daniel [mailto:[email protected]]
Sent: Friday, January 24, 2003 8:32 AM
To: [email protected]
Subject: st: constrained regression
Hi statalist,
a quick question: i want to run a regression that fits b1, b2, z(another
parameter), and the constant such that:
constant +b1*z==0
how would one do this? is there an easy way to add this restriction to the
regression command? i'm very sorry if this is something i should know, i'm
just not having any luck finding an answer.
thanks in advance for any and all help.
dan simundza
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/