Package jsl.utilities.random.arta
Class BivariateNORTACorrelationEvaluator
- java.lang.Object
-
- jsl.utilities.random.arta.BivariateNORTACorrelationEvaluator
-
- Direct Known Subclasses:
BivariateNORTACorrelationFinder
public class BivariateNORTACorrelationEvaluator extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
myAntitheticFlag
Whether or not to use antithetic variates in the replications uses to estimate the correlation The default is falseprotected double
myCorr
The input correlationprotected Statistic
myCorrStat
Used to estimate the statistics across replications for the correlationprotected Distribution
myD1
The distribution from which we want the correlated random variatesprotected Distribution
myD2
The distribution from which we want the correlated random variatesprotected int
myNumReps
The number of replications of the provided generate size that are used to estimate the actual correlation The default is 10.protected int
mySampleSize
The generate size used to estimate the actual correlation within one replication.protected NormalRV
snd
Standard normalprotected StatisticXY
statXY
Used to estimate the statistics of the indicated generate size
-
Constructor Summary
Constructors Constructor Description BivariateNORTACorrelationEvaluator(Distribution d1, Distribution d2, double correlation, int sampleSize, int numReps, boolean antitheticFlag)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
estimateCorrelation()
Estimates the correlation based on the provided number of replications of the given generate sizedouble
estimateCorrelation(double hwBound)
Estimates the correlation to the precision of the half-width bound The maximum number of replications is set at 20*getNumberOfReplications() The size of each generate for an individual replication is getSampleSize()double
estimateCorrelation(double hwBound, int sampleSize)
Estimates the correlation to the precision of the half-width bound The maximum number of replications is set at 20*getNumberOfReplications()double
estimateCorrelation(double hwBound, int sampleSize, int numReps)
Estimates the correlation to the precision of the half-width bound or until the specified number of replications has been metdouble
estimateCorrelation(int numReps)
Estimates the correlation based on the provided number of replications of the given generate sizedouble
estimateCorrelation(int numReps, int sampleSize)
Estimates the correlation based on the provided number of replications of the given generate sizeboolean
getAntitheticFlag()
The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replicationsdouble
getCorrelation()
This is the correlation set within the NORTA processStatisticAccessorIfc
getCorrelationStatistics()
After the correlation has been estimated, this method can be used to get the statistics across the replications on the correlationDistribution
getFirstDistribution()
int
getNumberOfReplications()
The number of replications of the provided generate size used to estimate the actual correlationint
getSampleSize()
This is the generate size used within each replication to estimate the actual correlationStatisticXY
getSampleStatistics()
After an individual generate for a replication has been generated this method can provide the statistics on the generateDistribution
getSecondDistribution()
static void
main(java.lang.String[] args)
double
sampleCorrelation(int sampleSize)
Returns an estimate of the correlation based on a generate of the provided sizevoid
setAntitheticFlag(boolean antitheticFlag)
The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replications.void
setCorrelation(double corr)
This is the correlation that will be used within the NORTA process This is not the desired correlation or the actual resulting correlationvoid
setFirstDistribution(Distribution distribution)
void
setNumberOfReplications(int numReps)
The number of replications of the provided generate size used to estimate the actual correlationvoid
setSampleSize(int sampleSize)
void
setSecondDistribution(Distribution distribution)
java.lang.String
toString()
Returns a String representation
-
-
-
Field Detail
-
snd
protected NormalRV snd
Standard normal
-
myD1
protected Distribution myD1
The distribution from which we want the correlated random variates
-
myD2
protected Distribution myD2
The distribution from which we want the correlated random variates
-
mySampleSize
protected int mySampleSize
The generate size used to estimate the actual correlation within one replication. The default is 1000
-
myNumReps
protected int myNumReps
The number of replications of the provided generate size that are used to estimate the actual correlation The default is 10.
-
myAntitheticFlag
protected boolean myAntitheticFlag
Whether or not to use antithetic variates in the replications uses to estimate the correlation The default is false
-
statXY
protected StatisticXY statXY
Used to estimate the statistics of the indicated generate size
-
myCorrStat
protected Statistic myCorrStat
Used to estimate the statistics across replications for the correlation
-
myCorr
protected double myCorr
The input correlation
-
-
Constructor Detail
-
BivariateNORTACorrelationEvaluator
public BivariateNORTACorrelationEvaluator(Distribution d1, Distribution d2, double correlation, int sampleSize, int numReps, boolean antitheticFlag)
- Parameters:
d1
-d2
-correlation
-sampleSize
-numReps
-antitheticFlag
-
-
-
Method Detail
-
getFirstDistribution
public final Distribution getFirstDistribution()
- Returns:
- the distribution
-
setFirstDistribution
public final void setFirstDistribution(Distribution distribution)
- Parameters:
distribution
- the distribution to set
-
getSecondDistribution
public final Distribution getSecondDistribution()
- Returns:
- the distribution
-
setSecondDistribution
public final void setSecondDistribution(Distribution distribution)
- Parameters:
distribution
- the distribution to set
-
getCorrelation
public final double getCorrelation()
This is the correlation set within the NORTA process- Returns:
- the correlation
-
setCorrelation
public final void setCorrelation(double corr)
This is the correlation that will be used within the NORTA process This is not the desired correlation or the actual resulting correlation- Parameters:
corr
- the correlation to set
-
getSampleSize
public final int getSampleSize()
This is the generate size used within each replication to estimate the actual correlation- Returns:
- the generate size
-
setSampleSize
public final void setSampleSize(int sampleSize)
- Parameters:
sampleSize
- the generate size to set, must be > 2
-
getNumberOfReplications
public final int getNumberOfReplications()
The number of replications of the provided generate size used to estimate the actual correlation- Returns:
- the number of replications
-
setNumberOfReplications
public final void setNumberOfReplications(int numReps)
The number of replications of the provided generate size used to estimate the actual correlation- Parameters:
numReps
- the number of replications
-
getAntitheticFlag
public final boolean getAntitheticFlag()
The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replications- Returns:
- the antitheticFlag
-
setAntitheticFlag
public final void setAntitheticFlag(boolean antitheticFlag)
The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replications. True means that antithetic sampling will be used. When this is set the number of replications represents the number of antithetic pairs to be sampled. /**- Parameters:
antitheticFlag
- the flag to set
-
estimateCorrelation
public final double estimateCorrelation()
Estimates the correlation based on the provided number of replications of the given generate size- Returns:
-
estimateCorrelation
public final double estimateCorrelation(int numReps)
Estimates the correlation based on the provided number of replications of the given generate size- Parameters:
numReps
- must be >=1- Returns:
-
estimateCorrelation
public final double estimateCorrelation(int numReps, int sampleSize)
Estimates the correlation based on the provided number of replications of the given generate size- Parameters:
numReps
- must be >=1sampleSize
- must be > 3- Returns:
-
estimateCorrelation
public final double estimateCorrelation(double hwBound)
Estimates the correlation to the precision of the half-width bound The maximum number of replications is set at 20*getNumberOfReplications() The size of each generate for an individual replication is getSampleSize()- Parameters:
hwBound
-- Returns:
-
estimateCorrelation
public final double estimateCorrelation(double hwBound, int sampleSize)
Estimates the correlation to the precision of the half-width bound The maximum number of replications is set at 20*getNumberOfReplications()- Parameters:
hwBound
-sampleSize
- The size of each generate for an individual replication- Returns:
-
estimateCorrelation
public final double estimateCorrelation(double hwBound, int sampleSize, int numReps)
Estimates the correlation to the precision of the half-width bound or until the specified number of replications has been met- Parameters:
hwBound
-sampleSize
- The size of each generate for an individual replicationnumReps
- The maximum number of replications- Returns:
-
getCorrelationStatistics
public final StatisticAccessorIfc getCorrelationStatistics()
After the correlation has been estimated, this method can be used to get the statistics across the replications on the correlation- Returns:
-
sampleCorrelation
public final double sampleCorrelation(int sampleSize)
Returns an estimate of the correlation based on a generate of the provided size- Parameters:
sampleSize
- must be > 2- Returns:
-
getSampleStatistics
public final StatisticXY getSampleStatistics()
After an individual generate for a replication has been generated this method can provide the statistics on the generate- Returns:
-
toString
public java.lang.String toString()
Returns a String representation- Overrides:
toString
in classjava.lang.Object
- Returns:
- A String with basic results
-
main
public static void main(java.lang.String[] args)
- Parameters:
args
-
-
-