Class PattonPolitisWhite2009ForObject<X>
- java.lang.Object
-
- dev.nm.stat.random.sampler.resampler.bootstrap.block.PattonPolitisWhite2009ForObject<X>
-
- All Implemented Interfaces:
ObjectResampler<X>
,Seedable
public class PattonPolitisWhite2009ForObject<X> extends Object implements ObjectResampler<X>
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PattonPolitisWhite2009ForObject.AutoCorrelationForObject
static interface
PattonPolitisWhite2009ForObject.AutoCovarianceForObject
static class
PattonPolitisWhite2009ForObject.Type
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_CACHE_SIZE
The default cache size = the number of available processors × 1000.
-
Constructor Summary
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static long
getOptimalBlockLength(Object[] x, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, PattonPolitisWhite2009ForObject.Type type)
Computes the optimal of block length.static long
getOptimalLag(Object[] x, PattonPolitisWhite2009ForObject.AutoCorrelationForObject R)
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.X[]
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
-
PattonPolitisWhite2009ForObject
public PattonPolitisWhite2009ForObject(X[] sample, Class<X> clazz, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance)
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 sampleclazz
- the class of the sample objectsautoCorrelation
- the autocorrelation function for the sample objectsautoCovariance
- the autocovariance function for the sample objects
-
PattonPolitisWhite2009ForObject
public PattonPolitisWhite2009ForObject(X[] sample, Class<X> clazz, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, PattonPolitisWhite2009ForObject.Type type)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampleclazz
- the class of the sample objectsautoCorrelation
- the autocorrelation function for the sample objectsautoCovariance
- the autocovariance function for the sample objectstype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULAR
-
PattonPolitisWhite2009ForObject
public PattonPolitisWhite2009ForObject(X[] sample, Class<X> clazz, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampleclazz
- the class of the sample objectsautoCorrelation
- the autocorrelation function for the sample objectsautoCovariance
- the autocovariance function for the sample objectstype
- the type of block bootstrap, either PattonPolitisWhite2009ForObject.Type.STATIONARY or PattonPolitisWhite2009ForObject.Type.CIRCULARuniform
- a concurrent random long generatorrng
- a concurrent random exponential generator
-
PattonPolitisWhite2009ForObject
public PattonPolitisWhite2009ForObject(X[] sample, Class<X> clazz, long blockLength, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampleclazz
- the class of the sample objectsblockLength
- 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
-
PattonPolitisWhite2009ForObject
public PattonPolitisWhite2009ForObject(X[] sample, Class<X> clazz, long blockLength, PattonPolitisWhite2009ForObject.Type type, ConcurrentCachedRLG rlg, ConcurrentCachedRNG rng)
Constructs a block bootstrap sample generator. The block length is automatically selected.- Parameters:
sample
- the original sampleclazz
- the class of the sample objectsblockLength
- 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
-
-
Method Detail
-
getOptimalBlockLength
public static long getOptimalBlockLength(Object[] x, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, 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(Object[] x, PattonPolitisWhite2009ForObject.AutoCorrelationForObject R)
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 X[] newResample()
Description copied from interface:ObjectResampler
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 interfaceObjectResampler<X>
- Returns:
- a resample, e.g., a bootstrap sample
-
-