Topic 2 Applications
Topic 2 Applications
Topic 2: Applications
. set obs 100 obs was 0, now 100 . gen wn=invnormal(uniform()) . gen t=_n . tsset t time variable: t, 1 to 100 delta: 1 unit
Stationary AR(1) . gen y1=wn if t==1 (99 missing values generated) . replace y1=1+0.5*l.y1+wn if t>1 (99 real changes made) . tsline y1
6 -2 0 0 y1 2 4
20
40 t
60
80
100
Random Walk . gen y2=wn if t==1 (99 missing values generated) . replace y2=1+ l.y2+wn if t>1 (99 real changes made) . tsline y2
100 y2 0 0 20 40 60 80
20
40 t
60
80
100
Non-Stationary AR(1) . gen y3=wn if t==1 (99 missing values generated) . replace y3=1+1.5*l.y3+wn if t>1 (99 real changes made) . tsline y3
6.00e+17 y3 0 0 2.00e+17 4.00e+17
20
40 t
60
80
100
Stationary AR(2) . gen y4=wn if t==1 (99 missing values generated) . replace y4=1+0.5*l.y4+wn if t==2 (1 real change made) . replace y4=1+0.5*l.y4+0.2*l2.y4+wn if t>2 (98 real changes made) . tsline y4
6 -2 0 0 y4 2 4
20
40
60
80
100
Invertible MA(1) . gen y5=wn if t==1 (99 missing values generated) . replace y5=wn+0.5*l.wn if t>1 (99 real changes made) . tsline y5
-2 0
-1
y5 0
20
40
60
80
100