Re: garchmvbootstrap.rpf
Posted: Fri Jan 23, 2026 9:02 am
A Forum for RATS Software and Econometrics Discussions
https://estima.com/forum/
As an exampleTomDoan wrote: ↑Fri Jan 23, 2026 11:29 am In viewtopic.php?p=19882#p19882, I describe a valid test for PoF in overlapping samples. If you aren't satisfied with the Wald test based on QMLE asymptotics, you can block bootstrap the exceedance data and get a bootstrapped distribution for the alphahat. (You don't have to do anything fancy to estimate alphahat since the point estimate is just the fraction of exceedances in each bootstrapped replication).
I can block bootstrap trigger within a loop, ndraws times, and calculate the means. That's straightforward.
Yes, the mean across bootstrap samples is approximately the same as the mean of the data.
I've plotted alphahatDist.
I don't know how to proceed?TomDoan wrote: ↑Sat Jan 24, 2026 11:06 am So you want to count the percentage of times the bootstrapped sample has an alphahat that is on the other side of alpha. (A two-sided test is not easy to construct in this situation). The closest example is bootsimple.rpf (which actually does generate a two-sided test, but that's when doing a sample mean, which symmetrizes more easily than a binomial).
Code: Select all
procedure acAlphaBlockBoot trigger start end
type series trigger
type integer start end
local integer startl endl
local integer draw N
local real alphahatStar
local series alphahatDist
local series boottrigger
local series[integer] bootentries
option real alpha 0.01
option integer horizon 1
option integer ndraws 10000
* Sample range
inquire(reglist) startl<<start endl<<end
# trigger
* Compute observed violation rate
sstats(mean) startl endl trigger>>%%alphahatObs
compute N = %nobs
* Create series to store bootstrap results
set alphahatDist 1 ndraws = 0.0
* Bootstrap loop
do draw = 1, ndraws
* Generate bootstrap block indices from the actual data range
BOOT(block=horizon) bootentries startl endl startl endl
* Resample the ACTUAL trigger series using those indices
set boottrigger startl endl = trigger(bootentries(t))
* Compute violation rate for this bootstrap sample
sstats(mean) startl endl boottrigger>>alphahatStar
compute alphahatDist(draw) = alphahatStar
end do draw
* Compute bootstrap statistics
stats(fractiles) alphahatDist 1 ndraws
compute %%bootmean = %mean
compute %%bootse = sqrt(%variance)
* --- Plot density function for alphabootdist ---
density(smoothing=2.0) alphahatDist 1 ndraws galphaboot falphaboot
* 10 horizons, 10 colours
compute col = %if(horizon==1,2,$
%if(horizon==2,4,$
%if(horizon==3,5,$
%if(horizon==4,6,$
%if(horizon==5,7,$
%if(horizon==6,8,$
%if(horizon==7,9,$
%if(horizon==8,10,$
%if(horizon==9,11,12)))))))))
spgraph(hea="",vfi=1,hfi=1)
scatter(key=upright,head="A non-parametric empirical approximation to the sampling distribution",$
hgrid=||%%bootmean||,style=line) 1
# galphaboot falphaboot 1 ndraws col
spgraph(done)
* --- Output Results ---
disp "=================================================="
disp " Alpha Block Bootstrap Unconditional Coverage Test"
disp "=================================================="
disp "Horizon (horizon): " horizon
disp "Sample size (N): " N
disp "Target alpha: " alpha
disp "Observed alphahat: " %%alphahatObs
disp "Bootstrap mean: " %%bootmean
disp "Bootstrap SE: " %%bootse
disp "=================================================="
end procedure