1) Get data from Excel that contains observations of gdp, unemployment, cpi and nx (net export);
2) make a mean test
3) after makes ADF-test
I can't use series.uroot(options) method at once, because this way needs set parameters - const, trend or none, but to choose one of them I need to make mean test.
So I tried this way:
Code: Select all
subroutine MeanTest(series v)
scalar Tstat=(@mean(v)*@(sqr(@obs(v))/@stdev(v) ' calculating t-statistics for serie's mean
if Tstat > 1.96 then
text Non_Zero_Mean 'I couldn't make a messagebox like in VB.NET to show the result, so I just made a
'text object which name informs me about the result :(
else
text Zero_Mean
endif
endsub
wfopen "C:\PATH"
group Data gdp cpi unemp nx
call MeanTest(gdp)
gdp.uroot(adf,const,info=sic)
..............................
call MeanTest(nx)
nx.uroot(adf,const,info=sic)
1) How to extract the p-value of ADF-test? It must be a concrete number, not vector or matrix, only number to use it like a simple numeric variable. I need this value to make a desision about taking differencies, for example if p-value isn't significant I would add to code something like this: if p-value < 0.05 then take difference (pseudocod)
2) Second problem is making a loop that will make MeanTest and ADF test for all series. I don't want to recall "MeanTest" subroutine and repeat ADF-test for every serie of group. Is it possible to make a loop for this case? Is there a construction similar to foreach loop in C#? I can do simple loops, but I don't know how to make a counter for series. I'd like to write smth like pseudocode:
Code: Select all
foreach (serie Xn in group Data)
call MeanTest(Xn)
Xn.uroot(adf,const,info=sic)I'm sorry guys if I annoy you with such simple questions and ugly codes( I'll be glad to get any kind of answer, thank you!
