|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectumontreal.iro.lecuyer.stat.list.ListOfStatProbes<E>
umontreal.iro.lecuyer.stat.list.ListOfTallies<E>
umontreal.iro.lecuyer.stat.list.ListOfTalliesWithCovariance<E>
umontreal.iro.lecuyer.stat.list.lincv.ListOfTalliesWithCV<E>
public class ListOfTalliesWithCV<E extends Tally>
Represents a list of tallies with control variables that inherits the functionalities of a list of tallies, and accepts vectors of length p + q. The first p tallies in the list correspond to X while the q last tallies correspond to C. Methods are provided for adding observations with control variables, and estimating the β* matrix from the sample covariances. Convenience methods are also provided for the common cases where q = 1 and p = 1.
During simulation or pilot runs,
one uses an add method
to add observations with the associated values of the
control variables.
After the vectors of observations (and controls)
are collected, one can obtain an estimate of
β*,
by using estimateBeta
.
One can also set β to an arbitrary matrix.
Before obtaining results with control variables,
it is important to set the expected values
of the controls, by using
setExpectedValues
.
After E[C] is set,
methods are then available to get the controlled average, and
the controlled covariance matrix.
One can also compute a confidence interval on a component Xi of
X taking
the control variables into account.
The β* matrix can be estimated using pilot runs. In this context, if the list of tallies is reset, the values of β and E[C] are retained. Observations generated from production runs can then be added to the list of tallies, and the controlled average can be computed.
The following pseudocode illustrates how q control variables can be used with a p-dimensional vector, the value of E[C] being stored in expControls.
Constructor Summary | |
---|---|
ListOfTalliesWithCV()
Constructs a new empty list of tallies with no control variable. |
|
ListOfTalliesWithCV(String name)
Constructs a new empty list of tallies with no control variable and name name. |
Method Summary | |
---|---|
void |
add(double[] x,
double[] c)
Adds a new observation (X, C) to this list of tallies. |
void |
add(double x,
double c)
Variant of the add
that can be used when p = q = 1. |
void |
add(double x,
double[] c)
Variant of the add
method that can be used when there is only one output variable. |
void |
averageC(double[] a)
Fills the given array with the averages of the control variables. |
void |
averageWithCV(double[] a)
Fills the given array with the controlled averages. |
double |
averageWithCV(int i)
Returns the average of the ith component of XC, denoted XC, i. |
void |
averageX(double[] a)
Fills the given array with the averages without control variables. |
ListOfTalliesWithCV<E> |
clone()
Clones this object. |
void |
confidenceIntervalStudentWithCV(int i,
double level,
double[] centerAndRadius)
Computes a confidence interval for the ith component of XC. |
void |
correlationC(DoubleMatrix2D c)
Fills c with the sample correlation matrix of C. |
void |
correlationCX(DoubleMatrix2D c)
Fills c with the sample correlation matrix of C and X. |
void |
correlationX(DoubleMatrix2D c)
Fills c with the sample correlation matrix of X. |
void |
covarianceC(DoubleMatrix2D c)
Fills c with the sample covariance matrix of C. |
void |
covarianceCX(DoubleMatrix2D c)
Fills c with the sample covariance matrix of C and X. |
void |
covarianceWithCV(DoubleMatrix2D covCV)
Computes the sample covariance of XC by replacing ΣX, ΣC, and ΣCX with the corresponding matrices of empirical covariances. |
double |
covarianceWithCV(int i,
int j)
Computes the covariance between component i and j of XC. |
void |
covarianceX(DoubleMatrix2D c)
Fills c with the sample covariance matrix of X. |
static ListOfTalliesWithCV<Tally> |
createWithTally(int p,
int q)
This factory method constructs and returns a list of tallies with p+q new instances of Tally , q being the number of control variables. |
static ListOfTalliesWithCV<TallyStore> |
createWithTallyStore(int p,
int q)
This factory method constructs and returns a list of tallies with p+q new instances of TallyStore , q being the number of control variables. |
void |
estimateBeta()
Estimates the β* matrix from the observations currently in this list of tallies. |
DoubleMatrix2D |
getBeta()
Returns the current matrix β. |
double |
getExpectedValue(int i)
Gets the expected value of the ith control variable. |
double[] |
getExpectedValues()
Returns E[C], the expected value of the vector of control variables. |
int |
getNumControlVariables()
Returns the number q of control variables. |
void |
init()
Initializes this list of statistical probes by calling init on each element. |
void |
setBeta(DoubleMatrix2D beta)
Sets the β matrix to beta. |
void |
setExpectedValue(int i,
double e)
Sets the expected value of the ith control variable to e. |
void |
setExpectedValues(double[] exp)
Sets E[C] to exp. |
void |
setNumControlVariables(int q)
Sets the number of control variables to q. |
int |
sizeWithoutCV()
Returns the size of this list excluding the control variables. |
void |
standardDeviationWithCV(double[] std)
Fills the given array with the square root of the variance of each component of XC. |
void |
varianceWithCV(double[] v)
Fills the given array with the variance of each component of XC. |
Methods inherited from class umontreal.iro.lecuyer.stat.list.ListOfTalliesWithCovariance |
---|
add, add, covariance, createWithTally, createWithTallyStore |
Methods inherited from class umontreal.iro.lecuyer.stat.list.ListOfTallies |
---|
areAllNumberObsEqual, average, correlation, correlation, covariance, numberObs, standardDeviation, variance |
Methods inherited from class umontreal.iro.lecuyer.stat.list.ListOfStatProbes |
---|
add, add, addAll, addAll, addArrayOfObservationListener, clear, clearArrayOfObservationListeners, contains, containsAll, equals, get, getName, hashCode, indexOf, isBroadcasting, isCollecting, isEmpty, isModifiable, iterator, lastIndexOf, listIterator, listIterator, notifyListeners, remove, remove, removeAll, removeArrayOfObservationListener, report, retainAll, set, setBroadcasting, setCollecting, setName, setUnmodifiable, size, subList, sum, toArray, toArray |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ListOfTalliesWithCV()
public ListOfTalliesWithCV(String name)
name
- the name of the list.Method Detail |
---|
public static ListOfTalliesWithCV<Tally> createWithTally(int p, int q)
Tally
, q being the number of control variables.
p
- the value of p.q
- the value of q.
public static ListOfTalliesWithCV<TallyStore> createWithTallyStore(int p, int q)
TallyStore
, q being the number of control variables.
p
- the value of p.q
- the value of q.
public void init()
ListOfStatProbes
init
on each element.
init
in class ListOfTalliesWithCovariance<E extends Tally>
public DoubleMatrix2D getBeta()
public void setBeta(DoubleMatrix2D beta)
beta
- the new β matrix.public double getExpectedValue(int i)
i
- the index of the control variable.
public void setExpectedValue(int i, double e)
i
- the index of the control variable.e
- the new value of the expectation.public double[] getExpectedValues()
public void setExpectedValues(double[] exp)
exp
- the new expected values for control variables.public int sizeWithoutCV()
public int getNumControlVariables()
public void setNumControlVariables(int q)
init
.
q
- the new number of control variables.public void correlationX(DoubleMatrix2D c)
c
- the p×p matrix filled with correlations.public void covarianceX(DoubleMatrix2D c)
c
- the p×p matrix filled with covariances.public void correlationC(DoubleMatrix2D c)
c
- the q×q matrix filled with correlations.public void covarianceC(DoubleMatrix2D c)
c
- the q×q matrix filled with covariances.public void correlationCX(DoubleMatrix2D c)
c
- the q×p matrix filled with correlations.public void covarianceCX(DoubleMatrix2D c)
c
- the q×p matrix filled with covariances.public void add(double[] x, double[] c)
x
- the value of X.c
- the value of C.public void add(double x, double[] c)
add
method that can be used when there is only one output variable.
x
- the output variable.c
- the vector of control variables.public void add(double x, double c)
add
that can be used when p = q = 1.
x
- the output variable.c
- the control variable.public double averageWithCV(int i)
i
- the index of the output variable.
public void covarianceWithCV(DoubleMatrix2D covCV)
covarianceX
,
covarianceC
,
and covarianceCX
, respectively.
This gives an estimate of
covCV
- the p×p matrix that will be filled
with covariances.public double covarianceWithCV(int i, int j)
i
- the index of the first component.j
- the index of the second component.
public void averageWithCV(double[] a)
public void averageX(double[] a)
a
- the array to be filled with averages.public void averageC(double[] a)
a
- the array to be filled with averages.public void standardDeviationWithCV(double[] std)
public void varianceWithCV(double[] v)
public void confidenceIntervalStudentWithCV(int i, double level, double[] centerAndRadius)
confidenceIntervalStudent
except that the variance with control variables, obtained by
covarianceWithCV (i, i), is used instead of the ordinary variance.
i
- the index of the component.level
- the level of confidence of the interval.centerAndRadius
- the array that will be filled with
the center and radius of the interval.public void estimateBeta()
covarianceC
and
covarianceCX
to get
estimates of
ΣC, and
ΣCX.
The result of the estimation of
getBeta
.
public ListOfTalliesWithCV<E> clone()
clone
in class ListOfTalliesWithCovariance<E extends Tally>
|
SSJ V. labo. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |