-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4. eviews code for fourier ardl analysis(2).prg
More file actions
107 lines (97 loc) · 2.89 KB
/
4. eviews code for fourier ardl analysis(2).prg
File metadata and controls
107 lines (97 loc) · 2.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
'EViews codes for Fractional Frequency Fourier ARDL analysis
'output matrix (mout)
matrix(2,2) mout
series y=gi
series x1=cpu
series x2=epu
series x3=gpr
series x4=eui
' manual calculation: long-run
' optimal frequncy: kk0
series trend=@trend+1
matrix(40,2) maic
matrix(40,1) mcof
scalar nn1=0
scalar aic0=-10000
For !kk=0.1 to 4 step 0.1
scalar no=@obs(y)
series sint=@sin(2*3.141592*trend*!kk/no)
series cost=@cos(2*3.141592*trend*!kk/no)
equation eq0.ls y y(-1) x1 x1(-1) x2 x2(-1) x3 x3(-1) x4 x4(-1) c sint cost
scalar aic1=eq0.@aic
scalar nn1=nn1+1
mcof(nn1,1)=eq0.@coefs(1)
maic(nn1,1)=eq0.@aic
maic(nn1,2)=!kk
if aic1>aic0 then
scalar kk0=!kk
scalar aic0=eq0.@aic
endif
next
series sint0=@sin(2*3.141592*@trend*kk0/no)
series cost0=@cos(2*3.141592*@trend*kk0/no)
equation eq0.ls y y(-1) x1 x1(-1) x2 x2(-1) x3 x3(-1) x4 x4(-1) c sint0 cost0
' manual calculation: short-run
scalar lr11=(eq0.@coef(2)+eq0.@coef(3))/(1-eq0.@coef(1))
scalar lr12=(eq0.@coef(4)+eq0.@coef(5))/(1-eq0.@coef(1))
scalar lr13=(eq0.@coef(6)+eq0.@coef(7))/(1-eq0.@coef(1))
scalar lr14=(eq0.@coef(8)+eq0.@coef(9))/(1-eq0.@coef(1))
scalar lr2=(eq0.@coef(11)+eq0.@coef(12))/(1-eq0.@coef(1))
series coin=y-lr11*x1-lr12*x2-lr13*x3-lr14*x4-lr2*(sint0+cost0)
equation eq11.ls d(y) d(x1) d(x2) d(x3) d(x4) coin(-1) c
equation eq12.ls d(y) d(x1) d(x2) d(x3) d(x4) c @trend sint0 cost0 y(-1) x1(-1) x2(-1) x3(-1) x4(-1)
scalar ssr1=eq12.@ssr
'equation eq13.ls d(y) d(x1) d(x2) d(x3) d(x4) c
equation eq13.ls d(y) d(x1) d(x2) d(x3) d(x4) c sint0 cost0
scalar ssr2=eq13.@ssr
scalar ff_num=(ssr2-ssr1)/(eq12.@ncoef-eq13.@ncoef)
scalar ff_den=ssr1/eq12.@df
scalar ff=ff_num/ff_den
mout(1,1)=kk0
mout(1,2)=ff
'calculation using "ardl
equation eq1.ardl(fixed, deplags=1, reglags=1) y x1 x2 x3 x4
equation eq10.ardl(fixed, trend=linear, deplags=1, reglags=1) y x1 x2 x3 x4 @ sint0 cost0
freeze(table1) eq10.boundstest
mout(2,1)=kk0
mout(2,2)=table1(50,2)
' 1) fixed
matrix(40,2) maic2
matrix(40,1) mcof2
scalar nn1=0
scalar aic02=-10000
For !kk=0.1 to 4 step 0.1
scalar no=@obs(y)
series sint=@sin(2*3.141592*trend*!kk/no)
series cost=@cos(2*3.141592*trend*!kk/no)
equation eq2.ardl(fixed, deplags=1, reglags=1) y x1 x2 x3 x4 @ sint cost
scalar aic2=eq2.@aic
scalar nn1=nn1+1
mcof2(nn1,1)=eq2.@coefs(1)
maic2(nn1,1)=eq2.@aic
maic2(nn1,2)=!kk
if aic2>aic02 then
scalar kk02=!kk
scalar aic02=eq2.@aic
endif
next
' 2) determined by AIC
matrix(40,2) maic3
matrix(40,1) mcof3
scalar nn1=0
scalar aic03=-10000
For !kk=0.1 to 4 step 0.1
scalar no=@obs(y)
series sint=@sin(2*3.141592*trend*!kk/no)
series cost=@cos(2*3.141592*trend*!kk/no)
equation eq3.ardl(deplags=1, reglags=3) y x1 x2 x3 x4 @ sint cost
scalar aic3=eq3.@aic
scalar nn1=nn1+1
mcof3(nn1,1)=eq3.@coefs(1)
maic3(nn1,1)=eq3.@aic
maic3(nn1,2)=!kk
if aic3>aic03 then
scalar kk03=!kk
scalar aic03=eq3.@aic
endif
next