SSJ
V. labo.

umontreal.iro.lecuyer.stat.list.lincv
Class FunctionOfMultipleMeansTallyWithCV

java.lang.Object
  extended by umontreal.iro.lecuyer.stat.StatProbe
      extended by umontreal.iro.lecuyer.stat.FunctionOfMultipleMeansTally
          extended by umontreal.iro.lecuyer.stat.list.lincv.FunctionOfMultipleMeansTallyWithCV
All Implemented Interfaces:
Cloneable

public class FunctionOfMultipleMeansTallyWithCV
extends FunctionOfMultipleMeansTally

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(μ, ν) = g(μ) - βft(C - ν), where βf = (βf,…, βf, q-1) is a q-dimensional vector. One must provide a definition for g(μ) and its gradient g(μ) through an implementation of the MultivariateFunction interface.


Constructor Summary
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.
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.
 
Method Summary
 FunctionOfMultipleMeansTallyWithCV clone()
          Clones this object and the function which is stored inside.
 void estimateBeta()
          Uses the sample averages and covariances obtained from the internal list of tallies to estimate the βf vector minimizing the variance of h(bar(X)n, C).
 void estimateBetaFromMatrix(DoubleMatrix2D mbeta)
          Multiples the given q×p matrix by the gradient g(bar(X)n) to get an estimate of the βf* vector minimizing the variance.
 double[] getBeta()
          Returns the βf vector.
 double getBeta(int i)
          Returns the value of βf, i.
 int getDimensionWithoutCV()
          Returns the dimension of this tally excluding the control variables.
 double getExpectedValue(int i)
          Gets the expected value of the ith component of ν.
 double[] getExpectedValues()
          Gets an array containing the vector ν.
 MultivariateFunction getFunctionWithoutCV()
          Returns the implementation computing the function g(μ).
 ListOfTalliesWithCV<Tally> getListOfTalliesWithCV()
          Returns the list of tallies with control variables used by this object.
 int getNumControlVariables()
          Returns the number of control variables being used.
 void setBeta(double[] beta)
          Sets the value of βf vector to beta.
 void setBeta(int i, double b)
          Sets the value of βf, i.
 void setExpectedValue(int i, double e)
          Sets the expected value of the ith component of ν to e.
 void setExpectedValues(double[] exp)
          Sets the vector ν to to given array exp.
 
Methods inherited from class umontreal.iro.lecuyer.stat.FunctionOfMultipleMeansTally
add, average, confidenceIntervalDelta, formatCIDelta, formatCIDelta, getConfidenceLevel, getDimension, getFunction, getListOfTallies, init, max, min, numberObs, report, reportAndCIDelta, reportAndCIDelta, setConfidenceIntervalDelta, setConfidenceIntervalNone, setConfidenceLevel, setName, setShowNumberObs, shortReport, shortReportHeader, standardDeviation, sum, variance
 
Methods inherited from class umontreal.iro.lecuyer.stat.StatProbe
addObservationListener, clearObservationListeners, getName, isBroadcasting, isCollecting, notifyListeners, removeObservationListener, report, report, setBroadcasting, setCollecting
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FunctionOfMultipleMeansTallyWithCV

public 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:
funcNoCV - the function used.
p - the number of dimensions.
q - the number of control variables.

FunctionOfMultipleMeansTallyWithCV

public 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.

Parameters:
funcNoCV - the function being computed.
l - the list of tallies used.
Method Detail

getFunctionWithoutCV

public MultivariateFunction getFunctionWithoutCV()
Returns the implementation computing the function g(μ). This differs from getFunction which returns h(μ, ν).

Returns:
the implementation computing the function g(μ).

getNumControlVariables

public int getNumControlVariables()
Returns the number of control variables being used.

Returns:
the number of control variables.

getDimensionWithoutCV

public int getDimensionWithoutCV()
Returns the dimension of this tally excluding the control variables. This corresponds to the result of getDimension minus the number of control variables.

Returns:
the dimension without control variables.

getBeta

public double getBeta(int i)
Returns the value of βf, i. This is set to 0 by default.

Parameters:
i - the index of the control variable.
Returns:
the value of βf, i.

setBeta

public void setBeta(int i,
                    double b)
Sets the value of βf, i.

Parameters:
i - the index of the control variable.
b - the value of βf, i.

getBeta

public double[] getBeta()
Returns the βf vector. By default, this is set to an array of 0's.

Returns:
the values of βf.

setBeta

public void setBeta(double[] beta)
Sets the value of βf vector to beta. The given array must have length q.

Parameters:
beta - the new βf vector.

getListOfTalliesWithCV

public ListOfTalliesWithCV<Tally> getListOfTalliesWithCV()
Returns the list of tallies with control variables used by this object.


getExpectedValue

public double getExpectedValue(int i)
Gets the expected value of the ith component of ν. This is set to 0 by default, and is equivalent to calling getExpectedValue on the internal list of tallies.

Parameters:
i - the component of ν to query.
Returns:
the queried expectation.

setExpectedValue

public void setExpectedValue(int i,
                             double e)
Sets the expected value of the ith component of ν to e. This is equivalent to calling setExpectedValue on the internal list of tallies.

Parameters:
i - the component of ν to set.
e - the new value of the expectation.

getExpectedValues

public double[] getExpectedValues()
Gets an array containing the vector ν. This returns an array of 0's by default, and is equivalent to calling getExpectedValues on the internal list of tallies.

Returns:
the vector ν.

setExpectedValues

public void setExpectedValues(double[] exp)
Sets the vector ν 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:
exp - the new ν vector.

estimateBeta

public void estimateBeta()
Uses the sample averages and covariances obtained from the internal list of tallies to estimate the βf vector minimizing the variance of h(bar(X)n, C). The asymptotically optimal vector is

βf* = ΣC-1ΣCXg(μ).

The method estimates this vector by replacing every quantity by its estimator. It first uses estimateBeta from the internal list of tallies to get a β matrix, and calls estimateBetaFromMatrix to get the βf vector.


estimateBetaFromMatrix

public void estimateBetaFromMatrix(DoubleMatrix2D mbeta)
Multiples the given q×p matrix by the gradient g(bar(X)n) to get an estimate of the βf* vector minimizing the variance. The matrix is usually obtained by estimateBeta. from the internal list of tallies.

Parameters:
mbeta - the β matrix.

clone

public FunctionOfMultipleMeansTallyWithCV 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.

Overrides:
clone in class FunctionOfMultipleMeansTally

SSJ
V. labo.

To submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.