dofor loop for different subsets of a data sample
Posted: Thu Jul 12, 2018 6:41 am
Dear Tom
I am trying to calculate information share for spot and futures prices for different periods, each containing 500 observations. So I need to divide the data sample into 2 subsamples, and I use dofor loop. Could you please check my dofor code to see if they are doing estimation for different non-overlapping periods?
And my 2nd question: how do I combine vectors in RATS?
my 3rd question: how do I suppress output being printed?
I am trying to calculate information share for spot and futures prices for different periods, each containing 500 observations. So I need to divide the data sample into 2 subsamples, and I use dofor loop. Could you please check my dofor code to see if they are doing estimation for different non-overlapping periods?
Code: Select all
dofor i=1 to 2
OPEN DATA "C:\Users\lshenb\Documents\01-Work files\Research\A-study\Bitcoin\Price discovery\15min\SBX.xlsx"
DATA(FORMAT=xlsx,ORG=COLUMNS) (i-1)*500+1 (i-1)*500+500 Spot BTC XBT
set y1 = LOG(Spot)
set y2 = LOG(BTC)
set y3 = LOG(XBT)
sstats(mean) / (y1-y2)>>mean12 (y1-y3)>>mean13
equation(coeffs=||1.0,-1.0,-mean12||) eq12
# y1 y2 constant
equation(coeffs=||1.0,-1.0,-mean13||) eq13
# y1 y3 constant
system(model=vecm)
variables y1 y2 y3
lags 1 to 2
ect eq12 eq13
end(system)
*
estimate
*
compute alphaperp=%perp(%vecmalpha)
compute psi=tr(alphaperp)
*
* Compute Choleski factorization of sigma
*
compute f=%decomp(%sigma)
*
* Compute decomposition of long-run variance
*
compute split=psi*f
compute contrib=split.^2/%dot(split,split)
*
disp "Decomposition of Long-run variance" contrib
end dofor imy 3rd question: how do I suppress output being printed?