On Fri, 17 Dec 2010, artur tarassow wrote:
I am using the current cvs on Win XP. I wrote the following script
to
obtain the johansen trace pvalue and test statistics recursively:
-----------------------------------
open denmark.gdt
smpl full
list Y = LRM IBO IDE
scalar p = 3 #recursive test for same lag length over all the period
matrix pv_trace = {}
matrix test_trace = {}
smpl 1980:1 1987:3
scalar T = $nobs
smpl 1974:1 1979:1
loop for (i=1; i<=T; i+=1)
coint2 p Y
matrix pval = $pvalue
pval = pval[,1]' #take the first column (Trace) and put it into row i
pv_trace = pv_trace | pval
matrix t = $test
t = t[,1]'
test_trace = test_trace | t
smpl ; +1
endloop
pv <- gnuplot 1 2 3 --with-lines --time-series \
--matrix=pv_trace --output=display --single-yaxis { set title
'Recursive p-value Trace-test'; }
test <- gnuplot 1 2 3 --with-lines --time-series \
--matrix=test_trace --output=display --single-yaxis { set title
'Recursive t-value Trace-test'; }
--------------------------------
Unfortunately I obtain the following error message "Warning: generated
non-finite values" for some reason.
Your script runs OK here. However, I'd suggest that your handling
of the sample period is a bit confusing, and the main body of your
script might be better re-written thus:
<script>
matrix pv_trace = {}
matrix test_trace = {}
# loop over sample end-point
loop i=1979:1..1987:3
coint2 p Y
# take the first column (Trace) and put it into row i
matrix pval = $pvalue
pv_trace |= pval[,1]'
matrix test = $test
test_trace |= test[,1]'
smpl ; i
endloop
</script>
Allin Cottrell