Package jsl.utilities.random.rvariable
Class BivariateNormalRV
- java.lang.Object
-
- jsl.utilities.random.rvariable.AbstractMVRVariable
-
- jsl.utilities.random.rvariable.BivariateNormalRV
-
- All Implemented Interfaces:
GetNameIfc
,IdentityIfc
,GetRandomNumberStreamIfc
,RNStreamControlIfc
,SetRandomNumberStreamIfc
,MVRVariableIfc
,MVSampleIfc
public class BivariateNormalRV extends AbstractMVRVariable
Allows for the generation of bi-variate normal random variables
-
-
Field Summary
-
Fields inherited from class jsl.utilities.random.rvariable.AbstractMVRVariable
myRNG
-
-
Constructor Summary
Constructors Constructor Description BivariateNormalRV()
Constructs a standard bi-variate normal with no correlationBivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho)
BivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho, int streamNum)
Constructs a bi-variate normal with the provided parametersBivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho, RNStreamIfc rng)
Constructs a bi-variate normal with the provided parametersBivariateNormalRV(RNStreamIfc rng)
Constructs a standard bi-variate normal with no correlation
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
getCorrelation()
Gets the correlationdouble
getMean1()
Gets the first meandouble
getMean2()
Gets the second meandouble
getVariance1()
Gets the first variancedouble
getVariance2()
Gets the 2nd varianceMVRVariableIfc
newInstance(RNStreamIfc rng)
double[]
sample()
java.lang.String
toString()
-
Methods inherited from class jsl.utilities.random.rvariable.AbstractMVRVariable
advanceToNextSubstream, getAntitheticOption, getId, getName, getRandomNumberStream, resetStartStream, resetStartSubstream, setAntitheticOption, setName, setRandomNumberStream
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface jsl.utilities.random.rng.GetRandomNumberStreamIfc
getStreamNumber
-
Methods inherited from interface jsl.utilities.random.rvariable.MVRVariableIfc
newInstance
-
Methods inherited from interface jsl.utilities.random.rvariable.MVSampleIfc
sample, sample
-
Methods inherited from interface jsl.utilities.random.rng.SetRandomNumberStreamIfc
setRandomNumberStream
-
-
-
-
Constructor Detail
-
BivariateNormalRV
public BivariateNormalRV()
Constructs a standard bi-variate normal with no correlation
-
BivariateNormalRV
public BivariateNormalRV(RNStreamIfc rng)
Constructs a standard bi-variate normal with no correlation
-
BivariateNormalRV
public BivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho)
- Parameters:
mean1
- mean of first coordinatevar1
- variance of first coordinatemean2
- mean of 2nd coordinatevar2
- variance of 2nd coordinaterho
- correlation between X1 and X2
-
BivariateNormalRV
public BivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho, int streamNum)
Constructs a bi-variate normal with the provided parameters- Parameters:
mean1
- mean of first coordinatevar1
- variance of first coordinatemean2
- mean of 2nd coordinatevar2
- variance of 2nd coordinaterho
- correlation between X1 and X2streamNum
- the stream number
-
BivariateNormalRV
public BivariateNormalRV(double mean1, double var1, double mean2, double var2, double rho, RNStreamIfc rng)
Constructs a bi-variate normal with the provided parameters- Parameters:
mean1
- mean of first coordinatevar1
- variance of first coordinatemean2
- mean of 2nd coordinatevar2
- variance of 2nd coordinaterho
- correlation between X1 and X2rng
- the RNStreamIfc
-
-
Method Detail
-
getMean1
public final double getMean1()
Gets the first mean- Returns:
- the first mean
-
getVariance1
public final double getVariance1()
Gets the first variance- Returns:
- the first variance
-
getMean2
public final double getMean2()
Gets the second mean- Returns:
- the second mean
-
getVariance2
public final double getVariance2()
Gets the 2nd variance- Returns:
- the 2nd variance
-
getCorrelation
public final double getCorrelation()
Gets the correlation- Returns:
- the correlation
-
sample
public final double[] sample()
- Returns:
- generates an array of random values
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
newInstance
public final MVRVariableIfc newInstance(RNStreamIfc rng)
- Parameters:
rng
- the RngIfc to use- Returns:
- a new instance with same parameter value
-
-