SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Package Attributes | List of all members
RQMCExperimentSeries Class Reference

This class offers facilities to perform experiments on the convergence of the variance when estimating a mean (expectation) with a series of RQMC point sets usually of the same type, but different sizes \(n\). More...

Collaboration diagram for RQMCExperimentSeries:
[legend]

Public Member Functions

 RQMCExperimentSeries (RQMCPointSet[] theSets, double base)
 Constructor with a give series of RQMC point sets. More...
 
void init (RQMCPointSet[] theSets, double base)
 Resets the array of RQMC point sets for this object, and initializes (re-creates) the arrays that will contain the results.
 
void setExecutionDisplay (boolean display)
 When set to true, a real-time display of execution results and CPU times will be printed on the default output.
 
void setBase (double b)
 Sets the base for the logs to b.
 
double getBase ()
 Returns the base used for the logs.
 
RQMCPointSet getSet (int i)
 Returns the point set number i associated to this object (starts at 0). More...
 
double [] getValuesn ()
 Returns the vector of values of n, after an experiment.
 
double [] getLogn ()
 Returns the vector of log_base(n), after an experiment.
 
double [] getMeans ()
 Returns the vector of means from last experiment, after an experiment.
 
double [] getVariances ()
 Returns the vector of variances from the last experiment. More...
 
double [] getLogVariances ()
 Returns the vector of log_base of variances from the last experiment.
 
void testVarianceRate (MonteCarloModelDouble model, int m)
 Performs an RQMC experiment with the given model, with this series of RQMC point sets. More...
 
void testVarianceRateCV (MonteCarloModelCV model, int m)
 Similar to testVarianceRate, but with control variates, all centered at 0.
 
double [] regressionLogVariance (int numSkip)
 Performs a linear regression of log(variance) vs log(n), and returns the coefficients (constant and slope) in two-dimensional vector. More...
 
String formatRegression (double[] regCoeff)
 Takes the regression coefficients of log(variance) in #regCoeff and returns a two-line string that reports on these coefficients. More...
 
String reportVarianceRate (int numSkip, boolean details)
 Produces and returns a report on the last experiment. More...
 
PgfDataTable toPgfDataTable (String tableName, String tableLabel)
 Takes the data from the most recent experiment and returns it in a PgfDataTable. More...
 
PgfDataTable toPgfDataTable (String tableLabel)
 
String dataForPlot ()
 Returns the data on the mean and variance for each n, in an appropriate format to produce a plot with the pgfplot package. More...
 
String dataLogForPlot ()
 Similar to dataForPlot, but for the log(variance) in terms of log n. More...
 
String testVarianceRateManyPointTypes (MonteCarloModelDouble model, ArrayList< RQMCPointSet[]> list, int m, int numSkip, boolean makePgfTable, boolean printReport, boolean details, ArrayList< PgfDataTable > listCurves)
 Performs an experiment (testVarianceRate) for each point set series in the given list, and returns a report as a string. More...
 
String toString ()
 Performs an experiment (testVarianceRate) for each point set series in the given list, and returns a report as a string.
 

Package Attributes

int numSets = 0
 
RQMCPointSet [] theSets
 
double base = 2.0
 
double logOfBase
 
double [] size = new double[numSets]
 
double [] mean = new double[numSets]
 
double [] variance = new double[numSets]
 
double [] logn = new double[numSets]
 
double [] logVar = new double[numSets]
 
String [] tableFields = {"n", "mean", "variance", "log(n)", "log(variance)"}
 
boolean displayExec = false
 
int numReplicates
 
MonteCarloModelDouble model
 
String cpuTime
 

Detailed Description

This class offers facilities to perform experiments on the convergence of the variance when estimating a mean (expectation) with a series of RQMC point sets usually of the same type, but different sizes \(n\).

The series of RQMC point sets of different sizes can be passed in an array to the constructor. The method testVarianceRate performs an experiment with a given MonteCarloModelDouble and the series of point sets. In this experiment, for each size \(n\) of point set, \(m\) independent replicates of the RQMC estimator (which is an average over RQMC \(n\) points) are computed. One can then recover the average and the empirical variance of these \(m\) replicates of the \(n\)-point average, their logs in any base, etc., in arrays, as well as the estimated linear regression of log(variance) as a function of log(n).

One can also perform experiments with many such series of point sets for the same model, and display the results for the different series on the same plot. Likewise, one can also perform an experiment with many different estimators for the same model and same point sets.

Constructor & Destructor Documentation

◆ RQMCExperimentSeries()

RQMCExperimentSeries ( RQMCPointSet []  theSets,
double  base 
)

Constructor with a give series of RQMC point sets.

Parameters
theSetsthe RQMC point sets.
basethe base used for all logarithms.

Member Function Documentation

◆ dataForPlot()

String dataForPlot ( )

Returns the data on the mean and variance for each n, in an appropriate format to produce a plot with the pgfplot package.

Returns
Report as a string.

◆ dataLogForPlot()

String dataLogForPlot ( )

Similar to dataForPlot, but for the log(variance) in terms of log n.

Returns
Report as a string.

◆ formatRegression()

String formatRegression ( double []  regCoeff)

Takes the regression coefficients of log(variance) in #regCoeff and returns a two-line string that reports on these coefficients.

Parameters
regCoeffthe regression coefficients.
Returns
Report as a string.

◆ getSet()

RQMCPointSet getSet ( int  i)

Returns the point set number i associated to this object (starts at 0).

Returns
the ith point set associated to this object

◆ getVariances()

double [] getVariances ( )

Returns the vector of variances from the last experiment.

Each variance in the vector is the empirical variance of the m replicates of the RQMC estimator. To obtain the variance per run, it must be multiplied by n.

◆ regressionLogVariance()

double [] regressionLogVariance ( int  numSkip)

Performs a linear regression of log(variance) vs log(n), and returns the coefficients (constant and slope) in two-dimensional vector.

The first numSkip values in the array are skipped (not used) to make the regression. This is useful if we want to focus the regression on larger values of n.

◆ reportVarianceRate()

String reportVarianceRate ( int  numSkip,
boolean  details 
)

Produces and returns a report on the last experiment.

Parameters
numSkipThe first numSkip values of n are skipped for the regression
detailsIf true, gives values (mean, log variance,...) for each n.
Returns
Report as a string.

◆ testVarianceRate()

void testVarianceRate ( MonteCarloModelDouble  model,
int  m 
)

Performs an RQMC experiment with the given model, with this series of RQMC point sets.

For each set in the series, computes m replicates of the RQMC estimator, the computes the average and the variance of these m replicates, and the logs of n and of the variance in the given base.

◆ testVarianceRateManyPointTypes()

String testVarianceRateManyPointTypes ( MonteCarloModelDouble  model,
ArrayList< RQMCPointSet[]>  list,
int  m,
int  numSkip,
boolean  makePgfTable,
boolean  printReport,
boolean  details,
ArrayList< PgfDataTable listCurves 
)

Performs an experiment (testVarianceRate) for each point set series in the given list, and returns a report as a string.

Parameters
model
list
m
Returns
a report on the experiment.

◆ toPgfDataTable()

PgfDataTable toPgfDataTable ( String  tableName,
String  tableLabel 
)

Takes the data from the most recent experiment and returns it in a PgfDataTable.

This will typically be used to plot the data.

Parameters
tableNameName (short identifier) of the table.
Returns
Report as a string.

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