[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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

From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Plotting (time-dependent) regression coefficients
Date   Thu, 17 Jan 2008 14:47:28 +0000 (GMT)

--- 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 -----------------
set more off
sysuse nlsw88, clear
gen ln_w = ln(wage)

recode grade 0/5=6
tab grade, gen(lev)
foreach lev of varlist lev* {
	gen unionX`lev' = union*`lev'
drop lev1

reg ln_w lev* unionX* tenure ttl_exp

matrix b = e(b)
matrix b = b[1, "unionXlev1".."unionXlev13"]'
matrix v = e(V)
matrix v = v["unionXlev1".."unionXlev13", ///
matrix v = vecdiag(v)'

sort grade
by grade: keep if _n == 1
keep grade
svmat b
svmat v

gen se = sqrt(v1)
gen lb = b1 - invttail(`e(df_r)', .025)*se
gen ub = b1 + invttail(`e(df_r)', .025)*se
twoway rcap lb ub grade || ///
       scatter b1 grade, yline(0)
*-------------------- end example -------------------------
(For more on how to use examples I sent to the Statalist, see )

Also see:

Hope this helps,

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Sent from Yahoo! Mail - a smarter inbox

*   For searches and help try:

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