Class ARTACorrelationEvaluator

  • Direct Known Subclasses:
    ARTACorrelationFinder

    public class ARTACorrelationEvaluator
    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 false
      protected AR1CorrelatedRNStream myCorrelatedRng
      The correlated random number generator used in the NORTA process
      protected RVariableIfc myDistribution
      The distribution from which we want the correlated random variates
      protected Statistic myLag1Stat
      Used to estimate the statistics across replications for the correlation
      protected 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 Statistic mySampleStat
      Used to estimate the statistics of the indicated generate size
    • Constructor Summary

      Constructors 
      Constructor Description
      ARTACorrelationEvaluator​(RVariableIfc randomVariable)
      Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation lag 1 correlation = 0.0 sampleSize = 1000 numReps = 1 antitheticFlag = false
      ARTACorrelationEvaluator​(RVariableIfc randomVariable, double lag1)
      Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation sampleSize = 100 numReps = 1 antitheticFlag = false
      ARTACorrelationEvaluator​(RVariableIfc randomVariable, double lag1, int sampleSize)
      Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation numReps = 1 antitheticFlag = false
      ARTACorrelationEvaluator​(RVariableIfc randomVariable, double lag1, int sampleSize, int numReps)
      Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation antitheticFlag = false
      ARTACorrelationEvaluator​(RVariableIfc randomVariable, double lag1, int sampleSize, int numReps, boolean antitheticFlag)
      Note that the randomVariable will be set to use a correlated random number generator, with the supplied lag 1 correlation
    • 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 size
      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()
      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 met
      double estimateCorrelation​(int numReps)
      Estimates the correlation based on the provided number of replications of the given generate size
      double estimateCorrelation​(int numReps, int sampleSize)
      Estimates the correlation based on the provided number of replications of the given generate size
      boolean getAntitheticFlag()
      The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replications
      double getCorrelation()
      This is the correlation set within the NORTA process
      StatisticAccessorIfc getLag1Statistics()
      After the correlation has been estimated, this method can be used to get the statistics across the replications on the lag 1 correlation
      int getNumberOfReplications()
      The number of replications of the provided generate size used to estimate the actual correlation
      RVariableIfc getRandomVariable()  
      int getSampleSize()
      This is the generate size used within each replication to estimate the actual correlation
      StatisticAccessorIfc getSampleStatistics()
      After an individual generate for a replication has been generated this method can provide the statistics on the generate
      static void main​(java.lang.String[] args)  
      double sampleCorrelation​(int sampleSize)
      Returns an estimate of the correlation based on a generate of the provided size
      void setAntitheticFlag​(boolean antitheticFlag)
      The antithetic flag can be use to turn on antithethic sampling when estimating the correlation with multiple replications.
      void setCorrelation​(double lag1)
      This is the correlation that will be used within the NORTA process This is not the desired correlation or the actual resulting correlation
      void setNumberOfReplications​(int numReps)
      The number of replications of the provided generate size used to estimate the actual correlation
      void setRandomVariable​(RVariableIfc randomVariable)  
      void setSampleSize​(int sampleSize)  
      java.lang.String toString()
      Returns a String representation
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • myCorrelatedRng

        protected AR1CorrelatedRNStream myCorrelatedRng
        The correlated random number generator used in the NORTA process
      • myDistribution

        protected RVariableIfc myDistribution
        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
      • mySampleStat

        protected Statistic mySampleStat
        Used to estimate the statistics of the indicated generate size
      • myLag1Stat

        protected Statistic myLag1Stat
        Used to estimate the statistics across replications for the correlation
    • Constructor Detail

      • ARTACorrelationEvaluator

        public ARTACorrelationEvaluator​(RVariableIfc randomVariable)
        Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation lag 1 correlation = 0.0 sampleSize = 1000 numReps = 1 antitheticFlag = false
        Parameters:
        randomVariable - the distribution
      • ARTACorrelationEvaluator

        public ARTACorrelationEvaluator​(RVariableIfc randomVariable,
                                        double lag1)
        Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation sampleSize = 100 numReps = 1 antitheticFlag = false
        Parameters:
        randomVariable - the distribution
        lag1 - the desired lag
      • ARTACorrelationEvaluator

        public ARTACorrelationEvaluator​(RVariableIfc randomVariable,
                                        double lag1,
                                        int sampleSize)
        Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation numReps = 1 antitheticFlag = false
        Parameters:
        randomVariable - the distribution
        lag1 - the desired lag
        sampleSize - the sample size
      • ARTACorrelationEvaluator

        public ARTACorrelationEvaluator​(RVariableIfc randomVariable,
                                        double lag1,
                                        int sampleSize,
                                        int numReps)
        Note that the distribution will be set to use a correlated random number generator, with the supplied lag 1 correlation antitheticFlag = false
        Parameters:
        randomVariable - the distribution
        lag1 - the desired lag
        sampleSize - the sample size
        numReps - the number of replications
      • ARTACorrelationEvaluator

        public ARTACorrelationEvaluator​(RVariableIfc randomVariable,
                                        double lag1,
                                        int sampleSize,
                                        int numReps,
                                        boolean antitheticFlag)
        Note that the randomVariable will be set to use a correlated random number generator, with the supplied lag 1 correlation
        Parameters:
        randomVariable - the distribution
        lag1 - the desired lag
        sampleSize - the sample size
        numReps - the number of replications
        antitheticFlag - use antithetics flag
    • Method Detail

      • getRandomVariable

        public final RVariableIfc getRandomVariable()
        Returns:
        the distribution
      • setRandomVariable

        public final void setRandomVariable​(RVariableIfc randomVariable)
        Parameters:
        randomVariable - the randomVariable to set
      • getCorrelation

        public final double getCorrelation()
        This is the correlation set within the NORTA process
        Returns:
        the lag 1 correlation
      • setCorrelation

        public final void setCorrelation​(double lag1)
        This is the correlation that will be used within the NORTA process This is not the desired correlation or the actual resulting correlation
        Parameters:
        lag1 - the lag 1 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:
        the estimated correlation
      • 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:
        the estimated correlation
      • 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 >=1
        sampleSize - must be > 3
        Returns:
        the estimated correlation
      • 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 - the half-width bound
        Returns:
        the estimated correlation
      • 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 - the half-width bound
        sampleSize - The size of each generate for an individual replication
        Returns:
        the estimated correlation
      • 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 - the half-width bound
        sampleSize - The size of each generate for an individual replication
        numReps - The maximum number of replications
        Returns:
        the estimated correlation
      • getLag1Statistics

        public final StatisticAccessorIfc getLag1Statistics()
        After the correlation has been estimated, this method can be used to get the statistics across the replications on the lag 1 correlation
        Returns:
        the lag 1 statistics
      • 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:
        the sample correlation
      • getSampleStatistics

        public final StatisticAccessorIfc getSampleStatistics()
        After an individual generate for a replication has been generated this method can provide the statistics on the generate
        Returns:
        the sample statistics
      • toString

        public java.lang.String toString()
        Returns a String representation
        Overrides:
        toString in class java.lang.Object
        Returns:
        A String with basic results
      • main

        public static void main​(java.lang.String[] args)