Class PattonPolitisWhite2009ForObject<X>
java.lang.Object
dev.nm.stat.random.sampler.resampler.bootstrap.block.PattonPolitisWhite2009ForObject<X>
- All Implemented Interfaces:
ObjectResampler<X>
,Seedable
This class implements the stationary and circular block bootstrapping method
with optimized block length.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static interface
static enum
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The default cache size = the number of available processors × 1000. -
Constructor Summary
ConstructorsConstructorDescriptionPattonPolitisWhite2009ForObject
(X[] sample, Class<X> clazz, long blockLength, PattonPolitisWhite2009ForObject.Type type, ConcurrentCachedRLG rlg, ConcurrentCachedRNG rng) Constructs a block bootstrap sample generator.PattonPolitisWhite2009ForObject
(X[] sample, Class<X> clazz, long blockLength, PattonPolitisWhite2009ForObject.Type type, RandomLongGenerator uniform, RandomNumberGenerator rng) Constructs a block bootstrap sample generator.PattonPolitisWhite2009ForObject
(X[] sample, Class<X> clazz, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance) Constructs a block bootstrap sample generator.PattonPolitisWhite2009ForObject
(X[] sample, Class<X> clazz, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, PattonPolitisWhite2009ForObject.Type type) Constructs a block bootstrap sample generator.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. -
Method Summary
Modifier and TypeMethodDescriptionstatic long
getOptimalBlockLength
(Object[] x, PattonPolitisWhite2009ForObject.AutoCorrelationForObject autoCorrelation, PattonPolitisWhite2009ForObject.AutoCovarianceForObject autoCovariance, PattonPolitisWhite2009ForObject.Type type) Computes the optimal of block length.static long
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[]
Gets a resample from the original sample.void
seed
(long... seeds) Seed the random number/vector/scenario generator to produce repeatable experiments.
-
Field Details
-
DEFAULT_CACHE_SIZE
public static final int DEFAULT_CACHE_SIZEThe default cache size = the number of available processors × 1000.
-
-
Constructor Details
-
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 Details
-
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:
-
seed
public void seed(long... seeds) Description copied from interface:Seedable
Seed the random number/vector/scenario generator to produce repeatable experiments. -
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
-