0% found this document useful (0 votes)
28 views4 pages

Topic 2 Applications

This document generates and plots different time series models including a stationary AR(1) process, a random walk, a non-stationary AR(1) process, a stationary AR(2) process, and an invertible MA(1) process using Stata code. For each model, the code generates the time series based on the specified parameters and white noise errors, sets the time series settings, and plots the generated time series.

Uploaded by

Shi Hong Ruan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

Topic 2 Applications

This document generates and plots different time series models including a stationary AR(1) process, a random walk, a non-stationary AR(1) process, a stationary AR(2) process, and an invertible MA(1) process using Stata code. For each model, the code generates the time series based on the specified parameters and white noise errors, sets the time series settings, and plots the generated time series.

Uploaded by

Shi Hong Ruan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

ECN 602

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

You might also like