Class PattonPolitisWhite2009
- java.lang.Object
-
- dev.nm.stat.random.sampler.resampler.bootstrap.block.PattonPolitisWhite2009
-
public class PattonPolitisWhite2009 extends Object implements Resampler
This class implements the stationary and circular block bootstrapping method with optimized block length.- See Also:
- Politis, N. Dimitris, White Halbert, "Automatic Block-Length Selection for the Dependent Bootstrap", Econometric Reviews , 2004
- Politis, D., White, H., Patton Andrew,"CORRECTION TO 'Automatic Block-Length Selection for the Dependent Bootstrap'", Econometric Reviews, 28(4):372–375, 2009
- R-code
-
-
Constructor Summary
Constructors Constructor Description PattonPolitisWhite2009(double[] sample)
Constructs a block bootstrap sample generator.PattonPolitisWhite2009(double[] sample, long blockLength, PattonPolitisWhite2009ForObject.Type type, ConcurrentCachedRLG rlg, ConcurrentCachedRNG rng)
Constructs a block bootstrap sample generator.PattonPolitisWhite2009(double[] sample, long blockLength, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator.PattonPolitisWhite2009(double[] sample, PattonPolitisWhite2009ForObject.Type type)
Constructs a block bootstrap sample generator.PattonPolitisWhite2009(double[] sample, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long
getOptimalBlockLength(double[] x, PattonPolitisWhite2009ForObject.Type type)
Computes the optimal of block length.static long
getOptimalLag(double[] x)
Finds the smallest lag \(\hat{m}\) such that the autocorrelation for lags \((\hat{m} + k),~k=1,\dots,K_N\) are all insignificant regarding to the critical value.double[]
newResample()
Gets a resample from the original sample.void
seed(long... seeds)
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
-
-
Constructor Detail
-
PattonPolitisWhite2009
public PattonPolitisWhite2009(double[] sample, long blockLength, PattonPolitisWhite2009ForObject.Type type, ConcurrentCachedRLG rlg, ConcurrentCachedRNG rng)
Constructs a block bootstrap sample generator.- Parameters:
sample
- the original sampleblockLength
- the block lengthtype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULARrlg
- a concurrent random long generatorrng
- a concurrent random exponential generator
-
PattonPolitisWhite2009
public PattonPolitisWhite2009(double[] sample, long blockLength, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator.- Parameters:
sample
- the original sampleblockLength
- the block lengthtype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULARuniform
- a uniform random number generatorrng
- a random exponential generator
-
PattonPolitisWhite2009
public PattonPolitisWhite2009(double[] sample, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampletype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULARuniform
- a concurrent random long generatorrng
- a concurrent random exponential generator
-
PattonPolitisWhite2009
public PattonPolitisWhite2009(double[] sample, PattonPolitisWhite2009ForObject.Type type)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampletype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULAR
-
PattonPolitisWhite2009
public PattonPolitisWhite2009(double[] sample)
Constructs a block bootstrap sample generator. The default method is PattonPolitisWhite2009ForObject.Type.STATIONARY block bootstrapping. The block length is automatically selected.- Parameters:
sample
- the original sample
-
-
Method Detail
-
getOptimalBlockLength
public static long getOptimalBlockLength(double[] x, PattonPolitisWhite2009ForObject.Type type)
Computes the optimal of block length. For stationary block bootstrap, the length of each block follows the geometric distribution with mean equal to the computed optimal length; for circular block bootstrap, the length of each block is fixed to the computed optimal length.- Parameters:
x
- the datatype
- the type of block bootstrap method- Returns:
- the optimal block length \(b_{opt} = \sqrt[3]{\frac{2\hat{G}^2N}{\hat{D}}}\)
-
getOptimalLag
public static long getOptimalLag(double[] x)
Finds the smallest lag \(\hat{m}\) such that the autocorrelation for lags \((\hat{m} + k),~k=1,\dots,K_N\) are all insignificant regarding to the critical value.- Parameters:
x
- the data- Returns:
- \(M = 2\hat{m}\)
- See Also:
- "footnote c, p. 59, Politis and etc. 2004"
-
seed
public void seed(long... seeds)
Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments.
-
newResample
public double[] newResample()
Description copied from interface:Resampler
Gets a resample from the original sample. It is very important this method is thread-safe so resampling can be run in parallel.- Specified by:
newResample
in interfaceResampler
- Returns:
- a resample, e.g., a bootstrap sample
-
-