I am trying to bootsrap VAR residuals in an i.i.d. fashion.
Particularly, I should use this i.i.d. bootstrap of the residuals to generate a given number (say 10.000) of data sets, each of the same lenght as the actual data (after throwing out the first 100 data points to diminish the effect of starting values). For each of the 10.000 samples I have to recalculate the VAR parameters. Then subtract the mean of these estimates from the original parameters to obtain the small sample bias.
For now I have attempted to program the very first part (bootstrapped residuals) as it follows:
Code: Select all
'estimate VAR
var var1.ls 1 4 y1 y2 y3 y4 y5 @ c
'get residuals to bootstrap
var1.makeresid(n=gres) res1 res2 res3 res4 res5
'set monte carlo parameters
!reps = 10000 'bootstrap replications
'set random number generator
rndseed(type=mt) 1234567
'bootstrap loop
for !i=1 to !reps
'bootstrap residuals
smpl smpl_est if res1<>na
gres.resample y1_a y2_a y3_a y4_a y5_a
next
Any hint will be highly appreciated .
Thanks
Corrado
