Package jslx.statistics
Class SNDiagnosticExperiment
- java.lang.Object
-
- jslx.statistics.SNDiagnosticExperiment
-
public class SNDiagnosticExperiment extends java.lang.ObjectUse the static create method to get a builder to builder the experiment with its addFactor data.Input uncertainty analyzer based on :
Song, E., and Nelson, B. L. (n.d.). Quickly assessing contributions to input uncertainty. IIE Transactions. http://doi.org/10.1080/0740817X.2014.980869
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSNDiagnosticExperiment.AddFactorDataStepIfcAdding addFactor data stepstatic classSNDiagnosticExperiment.BuilderA builder for creating SNDiagnosticExperimentstatic interfaceSNDiagnosticExperiment.BuildStepIfcThe ability to builder or add addFactor datastatic classSNDiagnosticExperiment.FactorInputDataA Factor Input Data class to hold the data needed by the SNDiagnosticExperimentstatic classSNDiagnosticExperiment.FactorOutputDataA addFactor output data class to hold data produced for each addFactor by the SNDiagnosticExperimentstatic classSNDiagnosticExperiment.SimRunner1static classSNDiagnosticExperiment.SimRunner2static classSNDiagnosticExperiment.SimRunner3static classSNDiagnosticExperiment.StochasticActivityNetwork
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringasString()static SNDiagnosticExperiment.AddFactorDataStepIfccreate(SNReplicationRunnerIfc sim)java.util.Map<java.lang.String,SNDiagnosticExperiment.FactorInputData>getFactorInputData()java.util.Map<java.lang.String,SNDiagnosticExperiment.FactorOutputData>getFactorOutputData()There will not be any addFactor output data until the diagnostic experiment is runjava.util.Optional<org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression>getFittedRegression()doublegetInputUncertaintyContribution(java.lang.String factor)intgetNumBootstrapSamples()intgetNumReplications()doublegetRelativeInputUncertaintyContribution(java.lang.String factor)doublegetRelativeSignificanceRatio(double stdError)The relative significance of input uncertainty to simulation estimator variability.doublegetTotalInputUncertainty()static voidmain(java.lang.String[] args)voidrunDiagnosticExperiment(int numBootstrapSamples, int numReplications)Uses common random numbers across simulation runsvoidrunDiagnosticExperiment(int numBootstrapSamples, int numReplications, boolean useCRN)static voidtest1()static voidtest2()static voidtest3()static voidtest4()java.lang.StringtoString()
-
-
-
Method Detail
-
create
public static final SNDiagnosticExperiment.AddFactorDataStepIfc create(SNReplicationRunnerIfc sim)
- Parameters:
sim- a reference to something that can run the simulation- Returns:
-
runDiagnosticExperiment
public void runDiagnosticExperiment(int numBootstrapSamples, int numReplications)Uses common random numbers across simulation runs- Parameters:
numBootstrapSamples- the number of bootstrap samples to make for each input distributionnumReplications- the number of replications in the diagnostic experiment
-
runDiagnosticExperiment
public void runDiagnosticExperiment(int numBootstrapSamples, int numReplications, boolean useCRN)- Parameters:
useCRN- , if true the stream for every random variable is the same across the bootstraps to facilitate common random number generation (CRN). If false different streams are used for each created random variable. Each factor gets its own unique stream regardless.numBootstrapSamples- the number of bootstrap samples to make for each input distributionnumReplications- the number of replications in the diagnostic experiment
-
getNumBootstrapSamples
public final int getNumBootstrapSamples()
- Returns:
- the number of bootstrap samples specified in the experiment
-
getNumReplications
public final int getNumReplications()
- Returns:
- the number of replications specified in the experiment
-
getTotalInputUncertainty
public final double getTotalInputUncertainty()
- Returns:
- the total input uncertainty across factors
-
getRelativeSignificanceRatio
public final double getRelativeSignificanceRatio(double stdError)
The relative significance of input uncertainty to simulation estimator variability. This is gamma of step 4, page 899 of Song and Nelson- Parameters:
stdError- the standard error of the simulation estimator- Returns:
- the relative significance estimate
-
getInputUncertaintyContribution
public final double getInputUncertaintyContribution(java.lang.String factor)
- Parameters:
factor- the name of the addFactor- Returns:
- the input uncertainty for the named addFactor
-
getRelativeInputUncertaintyContribution
public final double getRelativeInputUncertaintyContribution(java.lang.String factor)
- Parameters:
factor- the name of the addFactor- Returns:
- the relative input uncertainty for the named addFactor
-
getFactorInputData
public java.util.Map<java.lang.String,SNDiagnosticExperiment.FactorInputData> getFactorInputData()
- Returns:
- an unmodifiable map of the addFactor input data
-
getFactorOutputData
public java.util.Map<java.lang.String,SNDiagnosticExperiment.FactorOutputData> getFactorOutputData()
There will not be any addFactor output data until the diagnostic experiment is run- Returns:
- an unmodifiable map of the addFactor output data
-
getFittedRegression
public java.util.Optional<org.apache.commons.math3.stat.regression.OLSMultipleLinearRegression> getFittedRegression()
- Returns:
- the fitted regression, it will be null if not fitted yet
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
asString
public java.lang.String asString()
-
main
public static void main(java.lang.String[] args)
-
test1
public static void test1()
-
test2
public static void test2()
-
test3
public static void test3()
-
test4
public static void test4()
-
-