# Re: st: Plotting (time-dependent) regression coefficients

 From "Davide Cantoni" <[email protected]> To [email protected] Subject Re: st: Plotting (time-dependent) regression coefficients Date Thu, 17 Jan 2008 22:41:23 +0100

```Thank you, Maarten and Austin, for your most beautiful codes.

*------------------ begin example -----------------
g b=.
g se=.
forv i=1/13 {
replace b=_b[unionXlev`i'] in `i'
replace se=_se[unionXlev`i'] in `i'
}
*-------------------- end example -------------------------

How would I proceed if my interaction terms are not indexed with a
final figure 1 to N? In my case, they are indexed by quarters 95_1
95_2... etc. To make it clearer: of course the following does not
work:

*------------------ begin example -----------------
g b=.
g se=.
foreach i in 95_1 95_2 95_3 95_4 96_1 96_2 96_3 96_4  {
replace b=_b[_ItreXyea`i'] in `i'
replace se=_se[_ItreXyea`i'] in `i'
}
*-------------------- end example -------------------------

What would you suggest?

Thanks, Davide

On 17/01/2008, Austin Nichols <[email protected]> wrote:
> Maarten buis and Davide Cantoni:
>
> Note you do not need to destroy the data in memory to do this:
>
> sysuse nlsw88, clear
> gen ln_w = ln(wage)
> foreach lev of varlist lev* {
>        gen unionX`lev' = union*`lev'
> }
> drop lev1
> reg ln_w lev* unionX* tenure ttl_exp
> g g=_n+5 in 1/13
> la var g "Grade completed"
> g b=.
> g se=.
> forv i=1/13 {
>  replace b=_b[unionXlev`i'] in `i'
>  replace se=_se[unionXlev`i'] in `i'
> }
> gen lb = b-invttail(`e(df_r)', .025)*se
> gen ub = b+invttail(`e(df_r)', .025)*se
> la var b "Point Estimate"
> la var lb "Lower"
> la var ub "Upper bound of CI"
> tw rcap lb ub g ||sc b g, yline(0)
>
> On Jan 17, 2008 9:47 AM, Maarten buis <[email protected]> wrote:
> > --- Davide Cantoni <[email protected]> wrote:
> > > I am looking for an elegant way to plot the regression coefficients
> > > (including their 95% confidence interval) that result from a
> > > regression on the interactions of a treatment indicator and time.
> > > Ultimately, I have some coefficients for the "treatment effect" in
> > > every period of time, and I would like to plot their evolution.
> >
> > *------------------ begin example -----------------
> *
*
*   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/
```