-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path3. OxGuass code for ARDL analysis(2).src
More file actions
117 lines (98 loc) · 2.86 KB
/
3. OxGuass code for ARDL analysis(2).src
File metadata and controls
117 lines (98 loc) · 2.86 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
108
109
110
111
112
113
114
115
116
117
@===============================================================================@
@ OxGauss code for ARDL analysis @
@ Input: y: Tx1 vector of time series (LGDP) @
@ : x: Tx1 vector of time series (LPOP) @
@ Output: bounds test (BT) statistics @
@ Subprgram: none @
@ Max Lag length: 4 @
@===============================================================================@
closeall;
output file=bt_out(1).txt reset;
@=====Data input===============================================@
load data[26,5]=data1.txt;
rr=rows(data);
cc=cols(data);
y0=data[1:rr,1];
x1=data[1:rr,2];
x2=data[1:rr,3];
x3=data[1:rr,4];
x4=data[1:rr,5];
k=1;
@=====ARDL model===============================================@
"++ARDL method (long-run) ++";
n=rows(y0);
const=ones(n,1);
trend=seqa(1,1,n);
x=y0[k:n-1]~x1[k+1:n]~x1[k:n-1]~x2[k+1:n]~x2[k:n-1]~x3[k+1:n]~x3[k:n-1]~x4[k+1:n]~x4[k:n-1]~const[k+1:n]~trend[k+1:n];
y=y0[k+1:n];
invx=inv(x'x);
beta=invx*x'y;
e=y-x*beta;
ssr=e'e;
var=(e'e/(rows(y)-cols(x)))*invx;
sd=sqrt(diag(var));
t=beta./sd;
"beta=" beta;
"sd=" sd;
@=====ECM model===============================================@
"++ECM method++";
/* lr is long-run coefficient */
lr11=(beta[2]+beta[3])/(1-beta[1]);
lr12=(beta[4]+beta[5])/(1-beta[1]);
lr13=(beta[6]+beta[7])/(1-beta[1]);
lr14=(beta[8]+beta[9])/(1-beta[1]);
lr2=beta[5]/(1-beta[1]);
"lr11=" lr11;
"lr12=" lr12;
"lr13=" lr13;
"lr14=" lr14;
"lr2=" lr2;
coin=y0-lr11*x1-lr12*x2-lr13*x3-lr14*x4-lr2*trend;
n=rows(y0);
const=ones(n,1);
trend=seqa(1,1,n);
dy1=y0[2:n]-y0[1:n-1];
dx1=x1[2:n]-x1[1:n-1];
dx2=x2[2:n]-x2[1:n-1];
dx3=x3[2:n]-x3[1:n-1];
dx4=x4[2:n]-x4[1:n-1];
x=const[k+1:n]~dx1[k:n-1]~dx2[k:n-1]~dx3[k:n-1]~dx4[k:n-1]~trend[k+1:n]~coin[k:n-1];
y=dy1[k:n-1];
invx=inv(x'x);
beta=invx*x'y;
e=y-x*beta;
ssr=e'e;
var=(e'e/(rows(y)-cols(x)))*invx;
sd=sqrt(diag(var));
t=beta./sd;
"beta=" beta;
"sd=" sd;
@=====UECM model===============================================@
"++UECM method++";
n=rows(y0);
const=ones(n,1);
trend=seqa(1,1,n);
x=dx1[k:n-1]~dx2[k:n-1]~dx3[k:n-1]~dx4[k:n-1]~const[k+1:n]~trend[k+1:n]~y0[k:n-1]~x1[k:n-1]~x2[k:n-1]~x3[k:n-1]~x4[k:n-1];
x1=dx1[k:n-1]~dx2[k:n-1]~dx3[k:n-1]~dx4[k:n-1]~const[k+1:n];
y=dy1[k:n-1];
invx=inv(x'x);
beta=invx*x'y;
e=y-x*beta;
ee=e'e;
invx1=inv(x1'x1);
beta1=invx1*x1'y;
e1=y-x1*beta1;
ee1=e1'e1;
f_num=(ee1-ee)/(cols(x)-cols(x1));
f_den=ee/(rows(y)-cols(x));
ff=f_num/f_den;
ssr=e'e;
var=(e'e/(rows(y)-cols(x)))*invx;
sd=sqrt(diag(var));
t=beta./sd;
LK=-(rows(y)/2)*(1+ln(3.141593*2)+ln(e'e/rows(y)));
akaike=-2*(LK/rows(y))+2*(cols(x)/rows(y));
"beta=" beta;
"sd=" sd;
"Akaike Information Criterion =" akaike;
"Bounds test (BT) statistics=" ff;