SSJ  3.3.1
Stochastic Simulation in Java
Classes | Public Member Functions | List of all members
FunctionOfMultipleMeansTallyWithCV Class Reference

Represents a function of multiple means tally for an estimator with linear control variables. More...

Inheritance diagram for FunctionOfMultipleMeansTallyWithCV:
[legend]
Collaboration diagram for FunctionOfMultipleMeansTallyWithCV:
[legend]

Public Member Functions

 FunctionOfMultipleMeansTallyWithCV (MultivariateFunction funcNoCV, int p, int q)
 Creates a new function of multiple means tally for a function funcNoCV of p variables, and with q control variables. More...
 
 FunctionOfMultipleMeansTallyWithCV (MultivariateFunction funcNoCV, ListOfTalliesWithCV< Tally > l)
 Constructs a new function of multiple means tally with control variables from the list of tallies l, and the function funcNoCV. More...
 
MultivariateFunction getFunctionWithoutCV ()
 Returns the implementation computing the function \(g(\boldsymbol{\mu})\). More...
 
int getNumControlVariables ()
 Returns the number of control variables being used. More...
 
int getDimensionWithoutCV ()
 Returns the dimension of this tally excluding the control variables. More...
 
double getBeta (int i)
 Returns the value of \(\beta_{\mathrm{f},i}\). More...
 
void setBeta (int i, double b)
 Sets the value of \(\beta_{\mathrm{f},i}\). More...
 
double [] getBeta ()
 Returns the \(\boldsymbol{\beta}_{\mathrm{f}}\) vector. More...
 
void setBeta (double[] beta)
 Sets the value of \(\boldsymbol{\beta}_{\mathrm{f}}\) vector to beta. More...
 
ListOfTalliesWithCV< TallygetListOfTalliesWithCV ()
 Returns the list of tallies with control variables used by this object.
 
double getExpectedValue (int i)
 Gets the expected value of the \(i\)th component of \(\boldsymbol{\nu}\). More...
 
void setExpectedValue (int i, double e)
 Sets the expected value of the \(i\)th component of \(\boldsymbol{\nu}\) to e. More...
 
double [] getExpectedValues ()
 Gets an array containing the vector \(\boldsymbol{\nu}\). More...
 
void setExpectedValues (double[] exp)
 Sets the vector \(\boldsymbol{\nu}\) to to given array exp. More...
 
void estimateBeta ()
 Uses the sample averages and covariances obtained from the internal list of tallies to estimate the \(\boldsymbol{\beta}_{\mathrm{f}}\) vector minimizing the variance of \(h(\bar{\mathbf{X}}_n, \mathbf{C})\). More...
 
void estimateBetaFromMatrix (DoubleMatrix2D mbeta)
 Multiples the given \(q\times p\) matrix by the gradient \(\nabla g(\bar{\mathbf{X}}_n)\) to get an estimate of the \(\boldsymbol{\beta}_{\mathrm{f}}^*\) vector minimizing the variance. More...
 
FunctionOfMultipleMeansTallyWithCV clone ()
 Clones this object and the function which is stored inside. More...
 
- Public Member Functions inherited from FunctionOfMultipleMeansTally
 FunctionOfMultipleMeansTally (MultivariateFunction func, int d)
 Constructs a function of multiple means tally with dimension d, and function func. More...
 
 FunctionOfMultipleMeansTally (MultivariateFunction func, String name, int d)
 Constructs a function of multiple means tally with name name, dimension d, and function func. More...
 
 FunctionOfMultipleMeansTally (MultivariateFunction func, ListOfTalliesWithCovariance< Tally > ta)
 Constructs a function of multiple means tally using the function func and the list of tallies ta for observation management and covariance estimation. More...
 
void setName (String name)
 
ListOfTalliesWithCovariance< TallygetListOfTallies ()
 Returns the (unmodifiable) list of tallies internally used by this object. More...
 
MultivariateFunction getFunction ()
 Returns the function of multiple means used by this tally. More...
 
int getDimension ()
 Returns the dimension of this tally, i.e., the size of any vector of observations. More...
 
void add (double... x)
 ). More...
 
int numberObs ()
 Returns the number of vectors of observations given to this probe since its last initialization. More...
 
double average ()
 Computes \(\bar{\nu}_n=g(\bar{\mathbf{X}}_n)\), an estimate of the function of means \(\nu\). More...
 
double variance ()
 Estimates \(n\mathrm{Var}(g(\bar{\mathbf{X}}_n))\) where \(n\) is the number of vectors of observations given to this collector since the last initialization. More...
 
double standardDeviation ()
 Returns the square root of variance. More...
 
void confidenceIntervalDelta (double level, double[] centerAndRadius)
 Computes a confidence interval with confidence level level on \(\nu=g(\boldsymbol{\mu})\), using the delta theorem [214] . More...
 
String formatCIDelta (double level, int d)
 Similar to #confidenceIntervalDelta(double,double[]), but returns the confidence interval in a formatted string of the form "<tt>95% confidence interval for function of means: (32.431,  32.487)</tt>", using \(d\) decimal digits of accuracy. More...
 
String formatCIDelta (double level)
 Same as formatCIDelta(level, 3).
 
String report ()
 Returns a string containing a formatted report on this probe. More...
 
String reportAndCIDelta (double level, int d)
 Returns a string containing a formatted report on this probe (as in report ), followed by a confidence interval (as in formatCIDelta(double,int) ). More...
 
String reportAndCIDelta (double level)
 Same as reportAndCIDelta(level, 3). More...
 
String shortReportHeader ()
 
String shortReport ()
 Formats and returns a short statistical report for this function of multiple means tally. More...
 
double getConfidenceLevel ()
 Returns the level of confidence for the intervals on the mean displayed in reports. More...
 
void setConfidenceLevel (double level)
 Sets the level of confidence for the intervals on the mean displayed in reports. More...
 
void setConfidenceIntervalNone ()
 Indicates that no confidence interval needs to be printed in reports formatted by report, and shortReport. More...
 
void setConfidenceIntervalDelta ()
 Indicates that a confidence interval on the true mean, based on the delta and central limit theorems, needs to be included in reports formatted by report, and shortReport. More...
 
void setShowNumberObs (boolean showNumObs)
 Determines if the number of observations must be displayed in reports. More...
 
double min ()
 Returns Double.NaN.
 
double max ()
 Returns Double.NaN.
 
double sum ()
 Returns Double.NaN.
 
void init ()
 
FunctionOfMultipleMeansTally clone ()
 Clones this object. More...
 
- Public Member Functions inherited from StatProbe
abstract void init ()
 Initializes the statistical collector.
 
void setName (String name)
 Sets the name of this statistical collector to name.
 
String getName ()
 Returns the name associated with this probe, or null if no name was specified upon construction. More...
 
double min ()
 Returns the smallest value taken by the variable since the last initialization of this probe. More...
 
double max ()
 Returns the largest value taken by the variable since the last initialization of this probe. More...
 
double sum ()
 Returns the sum cumulated so far for this probe. More...
 
abstract double average ()
 Returns the average for this collector. More...
 
abstract String report ()
 Returns a string containing a report for this statistical collector. More...
 
abstract String shortReport ()
 Formats and returns a short, one-line report about this statistical probe. More...
 
abstract String shortReportHeader ()
 Returns a string containing the name of the values returned in the report strings. More...
 
boolean isBroadcasting ()
 Determines if this statistical probe is broadcasting observations to registered observers. More...
 
void setBroadcasting (boolean b)
 Instructs the probe to turn its broadcasting ON or OFF. More...
 
boolean isCollecting ()
 Determines if this statistical probe is collecting values. More...
 
void setCollecting (boolean b)
 Turns ON or OFF the collection of statistical observations. More...
 
void addObservationListener (ObservationListener l)
 Adds the observation listener l to the list of observers of this statistical probe. More...
 
void removeObservationListener (ObservationListener l)
 Removes the observation listener l from the list of observers of this statistical probe. More...
 
void clearObservationListeners ()
 Removes all observation listeners from the list of observers of this statistical probe.
 
void notifyListeners (double x)
 Notifies the observation x to all registered observers if broadcasting is ON. More...
 
StatProbe clone () throws CloneNotSupportedException
 

Additional Inherited Members

- Static Public Member Functions inherited from StatProbe
static String report (String globalName, StatProbe[] probes)
 Formats short reports for each statistical probe in the array probes while aligning the probes’ names. More...
 
static String report (String globalName, Iterable<? extends StatProbe > probes)
 Equivalent to #report(String,StatProbe[]), except that probes is an Iterable object instead of an array. More...
 
- Protected Attributes inherited from FunctionOfMultipleMeansTally
MultivariateFunction func
 
CIType confidenceInterval = CIType.CI_NONE
 
double level = 0.95
 
- Protected Attributes inherited from StatProbe
String name
 
double maxValue
 
double minValue
 
double sumValue
 
boolean collect = true
 
boolean broadcast = false
 
boolean showNobs = true
 

Detailed Description

Represents a function of multiple means tally for an estimator with linear control variables.

This extends the function of multiple means tally to use a function \(h(\boldsymbol{\mu}, \boldsymbol{\nu})=g(\boldsymbol{\mu})-\boldsymbol{\beta}_{\mathrm{f}}^{\mathsf{t}}(\mathbf{C}- \boldsymbol{\nu})\), where \(\boldsymbol{\beta}_{\mathrm{f}}=(\beta_{\mathrm{f},0},…,\beta_{\mathrm{f},q-1})\) is a \(q\)-dimensional vector. One must provide a definition for \(g(\boldsymbol{\mu})\) and its gradient \(\nabla g(\boldsymbol{\mu})\) through an implementation of the umontreal.ssj.util.MultivariateFunction interface.

Constructor & Destructor Documentation

◆ FunctionOfMultipleMeansTallyWithCV() [1/2]

FunctionOfMultipleMeansTallyWithCV ( MultivariateFunction  funcNoCV,
int  p,
int  q 
)

Creates a new function of multiple means tally for a function funcNoCV of p variables, and with q control variables.

The constructed tally requires vectors of p+q values as observations.

Parameters
funcNoCVthe function used.
pthe number of dimensions.
qthe number of control variables.

◆ FunctionOfMultipleMeansTallyWithCV() [2/2]

Constructs a new function of multiple means tally with control variables from the list of tallies l, and the function funcNoCV.

Parameters
funcNoCVthe function being computed.
lthe list of tallies used.

Member Function Documentation

◆ clone()

Clones this object and the function which is stored inside.

This clones the internal list of tallies as well as each tally in this list.

◆ estimateBeta()

void estimateBeta ( )

Uses the sample averages and covariances obtained from the internal list of tallies to estimate the \(\boldsymbol{\beta}_{\mathrm{f}}\) vector minimizing the variance of \(h(\bar{\mathbf{X}}_n, \mathbf{C})\).

The asymptotically optimal vector is

\[ \boldsymbol{\beta}_{\mathrm{f}}^* = \boldsymbol{\Sigma}_{\mathrm{C}}^{-1}\boldsymbol{\Sigma}_{\mathrm{CX}}\nabla g(\boldsymbol{\mu}). \]

The method estimates this vector by replacing every quantity by its estimator. It first uses umontreal.ssj.stat.list.lincv.ListOfTalliesWithCV.estimateBeta from the internal list of tallies to get a \(\boldsymbol{\beta}\) matrix, and calls estimateBetaFromMatrix(DoubleMatrix2D) to get the \(\boldsymbol{\beta}_{\mathrm{f}}\) vector.

◆ estimateBetaFromMatrix()

void estimateBetaFromMatrix ( DoubleMatrix2D  mbeta)

Multiples the given \(q\times p\) matrix by the gradient \(\nabla g(\bar{\mathbf{X}}_n)\) to get an estimate of the \(\boldsymbol{\beta}_{\mathrm{f}}^*\) vector minimizing the variance.

The matrix is usually obtained by umontreal.ssj.stat.list.lincv.ListOfTalliesWithCV.estimateBeta. from the internal list of tallies.

Parameters
mbetathe \(\boldsymbol{\beta}\) matrix.

◆ getBeta() [1/2]

double getBeta ( int  i)

Returns the value of \(\beta_{\mathrm{f},i}\).

This is set to 0 by default.

Parameters
ithe index of the control variable.
Returns
the value of \(\beta_{\mathrm{f},i}\).

◆ getBeta() [2/2]

double [] getBeta ( )

Returns the \(\boldsymbol{\beta}_{\mathrm{f}}\) vector.

By default, this is set to an array of 0’s.

Returns
the values of \(\boldsymbol{\beta}_{\mathrm{f}}\).

◆ getDimensionWithoutCV()

int getDimensionWithoutCV ( )

Returns the dimension of this tally excluding the control variables.

This corresponds to the result of umontreal.ssj.stat.FunctionOfMultipleMeansTally.getDimension minus the number of control variables.

Returns
the dimension without control variables.

◆ getExpectedValue()

double getExpectedValue ( int  i)

Gets the expected value of the \(i\)th component of \(\boldsymbol{\nu}\).

This is set to 0 by default, and is equivalent to calling getExpectedValue on the internal list of tallies.

Parameters
ithe component of \(\boldsymbol{\nu}\) to query.
Returns
the queried expectation.

◆ getExpectedValues()

double [] getExpectedValues ( )

Gets an array containing the vector \(\boldsymbol{\nu}\).

This returns an array of 0’s by default, and is equivalent to calling getExpectedValues on the internal list of tallies.

Returns
the vector \(\boldsymbol{\nu}\).

◆ getFunctionWithoutCV()

MultivariateFunction getFunctionWithoutCV ( )

Returns the implementation computing the function \(g(\boldsymbol{\mu})\).

This differs from getFunction which returns \(h(\boldsymbol{\mu}, \boldsymbol{\nu})\).

Returns
the implementation computing the function \(g(\boldsymbol{\mu})\).

◆ getNumControlVariables()

int getNumControlVariables ( )

Returns the number of control variables being used.

Returns
the number of control variables.

◆ setBeta() [1/2]

void setBeta ( int  i,
double  b 
)

Sets the value of \(\beta_{\mathrm{f},i}\).

Parameters
ithe index of the control variable.
bthe value of \(\beta_{\mathrm{f},i}\).

◆ setBeta() [2/2]

void setBeta ( double []  beta)

Sets the value of \(\boldsymbol{\beta}_{\mathrm{f}}\) vector to beta.

The given array must have length \(q\).

Parameters
betathe new \(\boldsymbol{\beta}_{\mathrm{f}}\) vector.

◆ setExpectedValue()

void setExpectedValue ( int  i,
double  e 
)

Sets the expected value of the \(i\)th component of \(\boldsymbol{\nu}\) to e.

This is equivalent to calling setExpectedValue on the internal list of tallies.

Parameters
ithe component of \(\boldsymbol{\nu}\) to set.
ethe new value of the expectation.

◆ setExpectedValues()

void setExpectedValues ( double []  exp)

Sets the vector \(\boldsymbol{\nu}\) to to given array exp.

The length of exp must be \(q\). This is equivalent to calling setExpectedValues on the internal list of tallies.

Parameters
expthe new \(\boldsymbol{\nu}\) vector.

The documentation for this class was generated from the following file: