Class BivariateNormal

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected double myMu1  
      protected double myMu2  
      protected double myRho  
      protected RNStreamIfc myRNG  
      protected double myVar1  
      protected double myVar2  
    • Constructor Summary

      Constructors 
      Constructor Description
      BivariateNormal()
      Constructs a standard bivariate normal with no correlation
      BivariateNormal​(double[] param)
      Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
      BivariateNormal​(double[] param, RNStreamIfc rng)
      Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
      BivariateNormal​(double mean1, double var1, double mean2, double var2, double rho)  
      BivariateNormal​(double mean1, double var1, double mean2, double var2, double rho, RNStreamIfc rng)
      Constructs a bivariate normal with the provided parameters
      BivariateNormal​(RNStreamIfc rng)
      Constructs a standard bivariate normal with no correlation
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void advanceToNextSubstream()
      Positions the RNG at the beginning of its next substream
      boolean getAntitheticOption()  
      double getCorrelation()
      Gets the correlation
      double getMean1()
      Gets the first mean
      double getMean2()
      Gets the second mean
      double[] getParameters()
      Returns the parameters as an array param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
      RNStreamIfc getRandomNumberGenerator()
      Returns the distributions underlying random number generator
      double[] getValues()
      Returns an array containing the bivariate pair x[0] = 1st marginal x[1] = 2nd marginal
      double[] getValues​(double[] x)
      Fills the supplied array with 2 values As a convenience also returns the array
      double getVariance1()
      Gets the first variance
      double getVariance2()
      Gets the 2nd variance
      void resetStartStream()
      The resetStartStream method will position the RNG at the beginning of its stream.
      void resetStartSubstream()
      Resets the position of the RNG at the start of the current substream
      void setAntitheticOption​(boolean flag)
      Tells the stream to start producing antithetic variates
      void setCorrelation​(double rho)
      Sets the correlation
      void setMean1​(double mean)
      Sets the first mean
      void setMean2​(double mean)
      Sets the second mean
      void setParameters​(double[] param)
      Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
      void setParameters​(double mean1, double var1, double mean2, double var2, double rho)
      Sets all the parameters
      void setRandomNumberGenerator​(RNStreamIfc rng)
      Sets the underlying random number generator for the distribution Throws a NullPointerException if rng is null
      void setVariance1​(double variance)
      Sets the first variance
      void setVariance2​(double variance)
      Sets the 2nd variance
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • myMu1

        protected double myMu1
      • myVar1

        protected double myVar1
      • myMu2

        protected double myMu2
      • myVar2

        protected double myVar2
      • myRho

        protected double myRho
    • Constructor Detail

      • BivariateNormal

        public BivariateNormal()
        Constructs a standard bivariate normal with no correlation
      • BivariateNormal

        public BivariateNormal​(RNStreamIfc rng)
        Constructs a standard bivariate normal with no correlation
      • BivariateNormal

        public BivariateNormal​(double mean1,
                               double var1,
                               double mean2,
                               double var2,
                               double rho)
        Parameters:
        mean1 -
        var1 -
        mean2 -
        var2 -
        rho -
      • BivariateNormal

        public BivariateNormal​(double[] param)
        Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
        Parameters:
        param -
      • BivariateNormal

        public BivariateNormal​(double[] param,
                               RNStreamIfc rng)
        Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
        Parameters:
        param -
        rng -
      • BivariateNormal

        public BivariateNormal​(double mean1,
                               double var1,
                               double mean2,
                               double var2,
                               double rho,
                               RNStreamIfc rng)
        Constructs a bivariate normal with the provided parameters
        Parameters:
        mean1 -
        var1 -
        mean2 -
        var2 -
        rho -
        rng -
    • Method Detail

      • setAntitheticOption

        public void setAntitheticOption​(boolean flag)
        Description copied from interface: RNStreamControlIfc
        Tells the stream to start producing antithetic variates
        Specified by:
        setAntitheticOption in interface RNStreamControlIfc
        Parameters:
        flag - true means that it produces antithetic variates.
      • resetStartStream

        public void resetStartStream()
        Description copied from interface: RNStreamControlIfc
        The resetStartStream method will position the RNG at the beginning of its stream. This is the same location in the stream as assigned when the RNG was created and initialized.
        Specified by:
        resetStartStream in interface RNStreamControlIfc
      • setParameters

        public final void setParameters​(double mean1,
                                        double var1,
                                        double mean2,
                                        double var2,
                                        double rho)
        Sets all the parameters
        Parameters:
        mean1 -
        var1 -
        mean2 -
        var2 -
        rho -
      • setParameters

        public final void setParameters​(double[] param)
        Interprets the array of parameters as the parameters param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
        Specified by:
        setParameters in interface ParametersIfc
        Parameters:
        param -
      • getParameters

        public final double[] getParameters()
        Returns the parameters as an array param[0] = mean 1; param[1] = variance 1; param[2] = mean 2; param[3] = variance 2; param[4] = correlation;
        Specified by:
        getParameters in interface ParametersIfc
        Returns:
      • setMean1

        public final void setMean1​(double mean)
        Sets the first mean
        Parameters:
        mean - of the distribution
      • getMean1

        public final double getMean1()
        Gets the first mean
        Returns:
      • setVariance1

        public final void setVariance1​(double variance)
        Sets the first variance
        Parameters:
        variance - of the distribution, must be > 0
      • getVariance1

        public final double getVariance1()
        Gets the first variance
        Returns:
      • setMean2

        public final void setMean2​(double mean)
        Sets the second mean
        Parameters:
        mean -
      • getMean2

        public final double getMean2()
        Gets the second mean
        Returns:
      • setVariance2

        public final void setVariance2​(double variance)
        Sets the 2nd variance
        Parameters:
        variance - of the distribution, must be > 0
      • getVariance2

        public final double getVariance2()
        Gets the 2nd variance
        Returns:
      • setCorrelation

        public final void setCorrelation​(double rho)
        Sets the correlation
        Parameters:
        rho -
      • getCorrelation

        public final double getCorrelation()
        Gets the correlation
        Returns:
      • getRandomNumberGenerator

        public RNStreamIfc getRandomNumberGenerator()
        Returns the distributions underlying random number generator
        Returns:
      • setRandomNumberGenerator

        public void setRandomNumberGenerator​(RNStreamIfc rng)
        Sets the underlying random number generator for the distribution Throws a NullPointerException if rng is null
        Parameters:
        rng - the reference to the random number generator
      • getValues

        public double[] getValues​(double[] x)
        Fills the supplied array with 2 values As a convenience also returns the array
        Parameters:
        x - Must be of size 2 or larger
        Returns:
      • getValues

        public double[] getValues()
        Returns an array containing the bivariate pair x[0] = 1st marginal x[1] = 2nd marginal
        Returns:
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object