Statalist


[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", ///
             "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
http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )

Also see: http://home.fsw.vu.nl/m.buis/wp/pvalue.html

Hope this helps,
Maarten

-----------------------------------------
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

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


      __________________________________________________________
Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.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/



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