# st: RE: Listing coefficient of one variable

 From "Maarten Buis" To 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: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu]On Behalf Of FUKUGAWA, N.
Sent: dinsdag 13 september 2005 15:02
To: statalist@hsphsun2.harvard.edu
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.

--
nfukugawa@gmail.com
*
*   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/
```