

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object Statistics.RandomVariable Statistics.ControlledRandomVariable
Class improving the convergence of conditional expectations in the class
RandomVariable
by the use of control variates.
Basically all methods in RandomVariable
can benefit from this
but we are only interested in expectations here.
Information: Random variables X are often observed in a context with increasing information becoming available about X as time t passes. Clearly one will draw from the distribution of X by conditioning on this information.
Exactly what information is available at time t and how to condition on it is context specific and handled by the implementations. If no information about X is available the parameter t is simply not used and so unconditional statistics computed.
Frequently this information is the realized path of a stochastic process up to time t and conditioning on this information means considering only paths which branch from the current path at time t.
Field Summary  
static int 
nBeta
Number of samples used to compute the betaCoefficient(int, int) . 
Constructor Summary  
ControlledRandomVariable()
Default constructor. 
Method Summary  
double 
betaCoefficient(int N)
Same as betaCoefficient(int,int) with no information to
condition on. 
double 
betaCoefficient(int t,
int N)
Computes the coefficient beta=Cov(X,Y)/Var(X), where Y is the control variate of ( this ) X conditioned on
information available at time t . 
double 
conditionalExpectation(int t,
double precision,
double confidence)
Same as conditionalExpectation(int,int) but sample size
increased until desired precision is reached with desired confidence. 
double 
conditionalExpectation(int t,
double precision,
double confidence,
int sampleGroupSize)
Same as conditionalExpectation(int,double,double) but samples
come in groups of dependent samples of size sampleGroupSize. 
double 
conditionalExpectation(int t,
int N)
Expectation of X conditioned on information available at time t and computed from a sample of size N. 
double 
conditionalExpectation(int t,
int N,
int m,
javax.swing.JProgressBar jPrgBar)
Same as conditionalExpectation(int,int) but with
computational progress reported to progress bar. 
RandomVariable 
controlled_X(int t)
Let X denote the current random variable ( this ). 
void 
controlVariateMeanTest()
Tests if the method for computing the mean of the control variate is correct by comparing the returned value against a Monte Carlo mean of the control variate. 
double 
correlationWithControlVariate(int N)
Same as correlationWithControlVariate(int,int)
but no information to condition on. 
double 
correlationWithControlVariate(int t,
int N)
The correlation of the control variate with ( this )
random variable X conditioned on information
available at time t and computed from a sample of size N. 
double 
expectation(double precision,
double confidence)
Same as conditionalExpectation(int,double,double)
but no information to condition on. 
double 
expectation(double precision,
double confidence,
int sampleGroupSize)
Same as conditionalExpectation(int,double,double,int)
but no information to condition on. 
double 
expectation(int N)
Unconditional expectation computed from a sample of size N. 
double 
expectation(int N,
int m,
javax.swing.JProgressBar jPrgBar)
Same as expectation(int) but with progress reported to a
progress bar. 
abstract double[] 
getControlledValue(int t)
Draws a sample x from the distribution of ( this ) X
conditioned on information available at
time t and computes the corresponding control variate cv. 
abstract double 
getControlVariateMean(int t)
The mean of the control variate conditioned on information available at time t. 
double 
getValue(int t)
Definition of super.getValue(int) from
getControlledValue() 
Methods inherited from class java.lang.Object 
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Field Detail 
public static final int nBeta
betaCoefficient(int, int)
.
Constructor Detail 
public ControlledRandomVariable()
Default constructor.
A ControlledRandomVariable
can be instantiated by
calling this constructor and defining the abstract methods
getControlledValue
and
getControlVariateMean
in the body of the constructor
call.
Method Detail 
public abstract double[] getControlledValue(int t)
Draws a sample x from the distribution of (this
) X
conditioned on information available at
time t and computes the corresponding control variate cv.
Returns the pair (x,cv)=(value, control variate) as a double[2].
t
 Current time (determines information to condition on).public abstract double getControlVariateMean(int t)
The mean of the control variate conditioned on information available at time t.
It is either known or derived from a simulation which is significantly faster than the simulation of (this
) X.
t
 Current time (determines information to condition on).public double getValue(int t)
Definition of super.getValue(int)
from
getControlledValue()
getValue
in class RandomVariable
t
 Current time (determines information to condition on).public void controlVariateMeanTest()
Tests if the method for computing the mean of the control variate is correct by comparing the returned value against a Monte Carlo mean of the control variate.
public double betaCoefficient(int t, int N)
Computes the coefficient beta=Cov(X,Y)/Var(X), where Y is the
control variate of (this
) X conditioned on
information available at time t .
N samples are generated to estimate this quantity. Recall that Cov(X,Y)=E(XY)E(X)E(Y) and Var(X)=E(X^2)E(X)^2.
t
 current time (determines information to condition on).N
 sample size.public double betaCoefficient(int N)
betaCoefficient(int,int)
with no information to
condition on.
N
 sample size.public double correlationWithControlVariate(int t, int N)
The correlation of the control variate with (this
)
random variable X conditioned on information
available at time t and computed from a sample of size N.
This routine is only called to test the quality of a prospective control variate. Thus we forgo efficiency and simply reduce this to variance, covariance computations.
t
 Current time (determines information to condition on).N
 Sample size.public double correlationWithControlVariate(int N)
Same as correlationWithControlVariate(int,int)
but no information to condition on.
N
 Sample size.public RandomVariable controlled_X(int t)
this
).
Then controlled_X(t) is the random variable X conditioned on
information available at time t and
controlled by the control variate Y of X.
A random sample of controlled_X(t) has the form
where beta is the beta coefficient
betaCoefficient(t,nBeta)
.
The ordinary mean of the random variable controlled_X(t) is the conditional mean of X at time t and the variance of controlled_X(t) is smaller than the conditional variance of X at time t.
t
 current time (determines information to condition on).public double conditionalExpectation(int t, int N)
Expectation of X conditioned on information available at time t and computed from a sample of size N.
It's simply the conditional expectation of the controlled version
Controlled_X
of X.
conditionalExpectation
in class RandomVariable
t
 current time (determines information to condition on).N
 sample size.public double expectation(int N)
Unconditional expectation computed from a sample of size N.
expectation
in class RandomVariable
N
 Sample size.public double conditionalExpectation(int t, int N, int m, javax.swing.JProgressBar jPrgBar)
Same as conditionalExpectation(int,int)
but with
computational progress reported to progress bar.
conditionalExpectation
in class RandomVariable
t
 Current time (determines information to condition on).N
 Sample size.m
 Progress report updated every m samples.jPrgBar
 Target of progress report.public double expectation(int N, int m, javax.swing.JProgressBar jPrgBar)
Same as expectation(int)
but with progress reported to a
progress bar.
expectation
in class RandomVariable
N
 sample size.m
 Progress report updated every m samples.jPrgBar
 Target of progress report.public double conditionalExpectation(int t, double precision, double confidence)
Same as conditionalExpectation(int,int)
but sample size
increased until desired precision is reached with desired confidence.
Generates at least 100 samples until precision or a maximum of 1000000 samples are reached.
conditionalExpectation
in class RandomVariable
t
 Current time (determines information to condition on).precision
 Bound on absolute error.confidence
 Probability that error bound is met.public double expectation(double precision, double confidence)
Same as conditionalExpectation(int,double,double)
but no information to condition on.
expectation
in class RandomVariable
precision
 Bound on absolute error.confidence
 Probability that error bound is met.public double conditionalExpectation(int t, double precision, double confidence, int sampleGroupSize)
Same as conditionalExpectation(int,double,double)
but samples
come in groups of dependent samples of size sampleGroupSize.
Note: the simulation must be set to start a new sample group before calling this routine.
conditionalExpectation
in class RandomVariable
t
 Current time (determines information to condition on).precision
 Bound on absolute error.confidence
 Probability that error bound is met.sampleGroupSize
 Size of groups of dependent samples.public double expectation(double precision, double confidence, int sampleGroupSize)
Same as conditionalExpectation(int,double,double,int)
but no information to condition on.
expectation
in class RandomVariable
precision
 bound on absolute error.confidence
 probability that error bound is met.sampleGroupSize
 Size of groups of dependent samples.


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 