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

From |
Maarten buis <maartenbuis@yahoo.co.uk> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: Generating trend on dummies |

Date |
Thu, 13 Sep 2007 15:04:58 +0100 (BST) |

--- Seema Bhatia <ler02sb@reading.ac.uk> wrote: > I have fitted a panel Random Effects model for my data over 20 years. > I have 4 dummies within the model in which I would like to see the > change over the 20 years. > > I would like to see how the dummies com, com_1, sadc and sadc_1 have > evolved over the 20 year period and plot them. I am told that the > within equation can be used to generate yearly coefficients this. Any > ideas on how I can use the within estimator to generate yearly > coefficients on each of these dummies? The answer depends on your grouping variable: Things are easy (though not necesarily correct) if you are grouping on year. In that case you make the dummies com, com_1, sadc, and sadc_1 random and use predict to get annual estimates. In your case it would be more common to group on country or dyad of countries. In that case you can get annual estimates by entering year in dummies and the interaction term of the dummies com, com_1, sadc, and sadc_1 with the annual dummies. One useful trick in this case is that by excluding the main effect of the dummies com, com_1, sadc, and sadc_1 you can enter all interactions, which are now directly the annual effects instead of deviations from the baseline year. This is shown in the example below (which, just for fun, also shows how to put 95% confidence intervals around those estimates): *-------------------- begin example ------------------ set more off webuse nlswork, clear /*create annual dummies*/ tab year, gen(yd) /*create interation effects*/ foreach var of varlist yd* { gen `var'Xgrade = `var'*grade } drop yd1 /*base category*/ xtmixed ln_w yd* age ttl_exp tenure || id: /*store annual effects*/ matrix b = e(b) matrix b = b[1, "ln_wage:yd1Xgrade".."ln_wage:yd15Xgrade"] matrix b = b' svmat b /*store confidence interval*/ matrix V = e(V) matrix V = V["ln_wage:yd1Xgrade".."ln_wage:yd15Xgrade", /* */ "ln_wage:yd1Xgrade".."ln_wage:yd15Xgrade"] matrix se = vecdiag(cholesky(diag(vecdiag(V))))' svmat se gen lb = b1 - 1.96*se1 gen ub = b1 + 1.96*se1 /*generate year*/ gen y = _n + 1967 if b1 < . /*create graph*/ twoway rcap ub lb y || scatter b1 y *------------------- 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 ) 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/ ----------------------------------------- ___________________________________________________________ Yahoo! Answers - Got a question? Someone out there knows the answer. Try it now. http://uk.answers.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/

**References**:**st: Generating trend on dummies***From:*Seema Bhatia <ler02sb@reading.ac.uk>

- Prev by Date:
**Re: st: Incorporating variable labels into the variable name** - Next by Date:
**Re: st: Memory allocation version 10 versus 9** - Previous by thread:
**st: Generating trend on dummies** - Next by thread:
**Re: st: Generating trend on dummies** - Index(es):

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