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
Nick Cox <[email protected]>
To
[email protected]
Subject
Re: st: plotting a regression function with time-dummies indicating structural breaks
Date
Tue, 3 May 2011 10:29:37 +0100
This is presumably a family of four curves given by a range on TIME_t
and Dummy_1 = 0, 1 and Dummy_2 = 0,1.
-twoway function- will take care of TIME_t = x but it is completely
dumb about the dummies. My guess is that it will use Dummy_1[1] and
Dummy_2[1] and give you just one of the four depending on values in
the first observation.
You will need to call -function- four times, but you don't need to
type the code four times.
Something like this:
forval a = 0/1 {
forval b = 0/1 {
local fcall `fcall' (function y = b_0 + b_1*x + `a'*(b_2 +
b_3*x) + b_4*`b', ///
range(TIME_t))
}
}
twoway (tsline y) `fcall' , legend(order(2 "0 0" 3 "0 1" 4 "1 0" 5 "1 1"))
I am assuming that this is generic code or that you have scalars b_0 .. b_4.
By the way, the -generate- line is irrelevant. -twoway function- works
with a generic x.
On Tue, May 3, 2011 at 10:10 AM, Oliver Jones
<[email protected]> wrote:
> I wonder if there is an easy way to plot a regression of the form:
>
> y_t = b_0 + b_1*TIME_t + Dummy_1*(b_2 + b_3*TIME_t) + b_4*Dummy_2
>
> So far I tried:
> gen x = TIME_t
> twoway ///
> (tsline y) ///
> (function y = b_0 + b_1*x + Dummy_1*(b_2 + b_3*x) + b_4*Dummy_2, ///
> range(`first_year' `last_year'))
>
> I seem to have a problem with the range, because the resulting graph just
> covers one third of the graph. But the shape seems to look ok, just
> compressed.
>
> Hopefully there is a nice way of plotting such stuff without the -function-
> command or some one has a hint regarding the range problem.
*
* 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/