garchmvbootstrap.rpf

Discussions of ARCH, GARCH, and related models
ac_1
Posts: 494
Joined: Thu Apr 15, 2010 6:30 am

Re: garchmvbootstrap.rpf

Unread post by ac_1 »

TomDoan wrote: Fri Jan 23, 2026 7:31 am Randomly rearranging (block bootstrapping) independent random variables as in your S4 does not produce correlated random variables.
Do you have an alternative solution as a procedure in RATS?
TomDoan
Posts: 7822
Joined: Wed Nov 01, 2006 4:36 pm

Re: garchmvbootstrap.rpf

Unread post by TomDoan »

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).
ac_1
Posts: 494
Joined: Thu Apr 15, 2010 6:30 am

Re: garchmvbootstrap.rpf

Unread post by ac_1 »

TomDoan 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).
As an example
https://estima.com/RATSBetaHelp/topics/ ... aprpf.html

calculating p-value: is it always > rather than >=, i.e. not to include the equality, in bootstrapping

*
* Figure out the bootstrapped p-value
*
sstats(mean) 1 ndraws (stats>%cdstat)>>pvalue
TomDoan
Posts: 7822
Joined: Wed Nov 01, 2006 4:36 pm

Re: garchmvbootstrap.rpf

Unread post by TomDoan »

No. That's a different type of bootstrap (which is bootstrapping data under the null). You need to compare the results with the assumed value of alpha.
ac_1
Posts: 494
Joined: Thu Apr 15, 2010 6:30 am

Re: garchmvbootstrap.rpf

Unread post by ac_1 »

TomDoan wrote: Sat Jan 24, 2026 8:12 am No. That's a different type of bootstrap (which is bootstrapping data under the null). You need to compare the results with the assumed value of alpha.
I can block bootstrap trigger within a loop, ndraws times, and calculate the means. That's straightforward.

The question is what’s the p-value?
Something like (compare the results with the target value of alpha)

sstats(mean) 1 ndraws %if( abs( Tstar ) > abs( T ),1.0,0.0)>>pvalue

Tstar = (bootstrapping trigger as a mean in a loop) - (actual violation rate e.g. 0.007 in the sample)
T = (actual violation rate e.g. 0.007 in the sample) - (target alpha e.g. 0.01)

And with large ndraws either using > or >= the difference is negligible.
TomDoan
Posts: 7822
Joined: Wed Nov 01, 2006 4:36 pm

Re: garchmvbootstrap.rpf

Unread post by TomDoan »

No. You're not bootstrapping to get an estimate of alpha; the mean across bootstrap samples should be roughly the same as the mean of the data. Instead, you're bootstrapping to get the sampling distribution and to compare that to the assumed value of alpha. 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).
ac_1
Posts: 494
Joined: Thu Apr 15, 2010 6:30 am

Re: garchmvbootstrap.rpf

Unread post by ac_1 »

TomDoan wrote: Sat Jan 24, 2026 11:06 am No. You're not bootstrapping to get an estimate of alpha; the mean across bootstrap samples should be roughly the same as the mean of the data.
Yes, the mean across bootstrap samples is approximately the same as the mean of the data.
TomDoan wrote: Sat Jan 24, 2026 11:06 am Instead, you're bootstrapping to get the sampling distribution and to compare that to the assumed value of alpha.
I've plotted alphahatDist.
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).
I don't know how to proceed?

Here's where I'm at (it's straightforward to do the bootstrap loop and plot the distribution) - I am aiming for a p-value to test for frequency.

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
TomDoan
Posts: 7822
Joined: Wed Nov 01, 2006 4:36 pm

Re: garchmvbootstrap.rpf

Unread post by TomDoan »

Compute the percentage of draws that are on the wrong side of the hypothesized alpha.

sstats(mean) 1 ndraws (alphahatDist>alpha)>>pctover (alphadataDist<alpha)>>pctunder

whichever of pctover and pctunder is appropriate. See the first example in the description of SSTATS.
TomDoan
Posts: 7822
Joined: Wed Nov 01, 2006 4:36 pm

Re: garchmvbootstrap.rpf

Unread post by TomDoan »

ac_1 wrote: Sun Jan 25, 2026 1:09 pm acKupiecBlockBoot.src is wrong, can it be fixed?
11.1 fixed a problem with parameters or options inside PARMSETS used in SUMMARIZE.
Post Reply