Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Listing coefficient of one variable


From   "Maarten Buis" <[email protected]>
To   <[email protected]>
Subject   st: RE: Listing coefficient of one variable
Date   Tue, 13 Sep 2005 15:21:29 +0200

You have three options:

Here all coefficients are different for different values of d:
forvalues i = 1/100 {
	reg y a b c if d ==`i'
}

Here only the coefficient of c changes with values of d (and the coefficient of c is the coefficient when d is that specific value of d): 
forvalues i = 1/100 {
	gen dum = d~=`i'
	gen dumXc =dum*c
	di "d = " `i'
	reg y a b c dum dumXc
	capture drop dum dumXc
}

A more parsimonious model is obtained if you are willing to assume that the parameter of c changes linearly with d. In this case you can just use an interaction term. Here the coefficient of c is the effect of c when d = 0 and the coefficient of dXc is how much the effect of c changes when d increases with one unit:
gen dXc = d*c
reg y a b c d dXc

HTH,
Maarten


-----Original Message-----
From: [email protected] [mailto:[email protected]]On Behalf Of FUKUGAWA, N.
Sent: dinsdag 13 september 2005 15:02
To: [email protected]
Subject: st: Listing coefficient of one variable

Dear all,
Suppose we run a regression model as follows
reg y a b c
and want to know how coefficient of "c" varies according to "d",
how can I write a program?

Note: "d" is integer between 1 and 100 and does not appear in the model and we
do not want to write 100 programs such as
reg y a b c if d==1.

Thanks in advance.
--
FUKUGAWA Nobuya, Ph.D.
[email protected]
*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index