On Fri, 23 Dec 2011, clarodina(a)lycos.com wrote:
Is there some steps examples on how to use BFGSmax to
determine the alpha and beta of d2 and d3
d1= alpha * d2 + beta * d3
with maximization of t value from adf 0 d1
If d2 and d3 are actual data, while d1 is just "some linear
combination of d2 and d3, the coefficients to be determined
somehow", and the object is to have that linear combination as
close to stationary as possible, then it sounds as if you want
a cointegration analysis. In that case you don't need BFGS;
see the "coint2" and "vecm" commands.
However, if you really just want to maximize the ADF tau for
d1 with respect to alpha and beta, taking d2 and d3 as given,
then here's an example:
<hansl>
function scalar adf_t (matrix *b, series d2, series d3)
series d1 = b[1]*d2 + b[2]*d3
adf 0 d1 --c --quiet
scalar tau = $test
return tau
end function
open data3-6
matrix b = {1,1}
set max_verbose on
tau_max = BFGSmax(b, adf_t(&b, Ct, Yt))
print b
series d1 = b[1]*Ct + b[2]*Yt
adf 0 d1 --c
</hansl>
Allin Cottrell