Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: plotting a regression function with time-dummies indicating structural breaks
From
Oliver Jones <[email protected]>
To
[email protected]
Subject
Re: st: plotting a regression function with time-dummies indicating structural breaks
Date
Tue, 03 May 2011 13:33:59 +0200
Hi Nick and Maarten,
people like you are the ones that make this list so very helpful!
Thanks a lot.
Oliver
Am 03.05.2011 12:16, schrieb Maarten buis:
--- Oliver Jones<[email protected]>
here is some example I just made up, that shows what I mean by "range
problem"
Notice that, as Nick already told you, -twoway function- cannot include
variables in the way you use it in your example. You must "create" your
dummies on the fly within your -twoway function- specification. So in
the example below I changed -d1- with -(x>1995)- and -d2- with
-(x>2005)-. For more on this trick see:
<http://www.stata.com/support/faqs/data/trueorfalse.html>
*--------------------------- begin example ---------------------
clear
set obs 20
gen int TIME = _n + 1990
* create dummies
gen byte d1 = 0
replace d1 = 1 if TIME> 1995
gen byte d2 = 0
replace d2 = 1 if TIME> 2005
tsset TIME
* set coefficients
scalar b_0 = 100
scalar b_1 = 2
scalar b_2 = 10000
scalar b_3 = -5
scalar b_4 = 20
* generate the time series
set seed 1
gen u = rnormal(0,2)
gen y = b_0 + b_1*TIME + b_2*d1 + b_3*d1*TIME + b_4*d2 + u
tw ///
(tsline y) ///
(function y = b_0 + b_1*x + b_2*(x>1995) + b_3*(x>1995)*x + b_4*(x>2005), ///
range(1991 2010)), ///
legend(order(1 "tsline" 2 "function"))
*-------------------------------- end example ----------------------------------
Hope this helps,
Maarten
--------------------------
Maarten L. Buis
Institut fuer Soziologie
Universitaet Tuebingen
Wilhelmstrasse 36
72074 Tuebingen
Germany
http://www.maartenbuis.nl
--------------------------
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
--
Universität Bielefeld
Fakultät für Wirtschaftswissenschaften
Lehrstuhl für Ökonometrie und Statistik
- -
Bielefeld University
Faculty of Business Administration and Economics
Chair of Econometrics and Statistics
- -
Raum / room: V9-110
Tel / phone: +49 (0)521 106 4871
---
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/