The Histogram class is used to compute statistics. More...
#include <ocsHistogram.hh>
Public Member Functions | |
Histogram () | |
Histogram (int qtBins2, double MinRange2, double MaxRange2) | |
Histogram constructor. | |
Histogram (string InFileName) | |
Histogram constructor: Reads parameters from a file. | |
void | InitHistogram (string InFileName) |
~Histogram () | |
Histogram destructor. | |
void | ReleaseMemory (void) |
Called by destructor ~Histogram(). | |
void | ClearHistogram (void) |
Reinitializes histogram. | |
void | AddSample (double vSample) |
Adds a sample to the histogram. | |
void | AddImportantSample (double vSample, double LikelihoodRatio) |
Adds a sample to the histogram. Used in importance sampling. | |
void | ImportData (string InFileName, int Column, int qtColumns) |
void | ImportData (string InFileName) |
void | SetFileNameWithSamples (string FileNameWithSamples2) |
void | Obtain_pdf (void) |
Converts a histogram into a probability density function (pdf). | |
void | MultipleHeuristicBalanceImport (string InFileName, int Convert2dB_Scale) |
The method of choice for merging in multiple importance sampling. | |
void | MergeMultipleConditionalHeuristicBalance (string InFileName, double z_min, double z_max, int Convert2dB_Scale) |
void | MergeMultipleConditionalHeuristicBalance (string InFileName, double z_min, double z_max, double w_min, double w_max, int Convert2dB_Scale) |
void | MultipleWeightedImport (string InFileName) |
NOT USED AT MOMENT. | |
void | MultipleSelectMaxRelNumHitsImport (string InFileName, int Convert2dB_Scale) |
void | MultipleSelectiveImport (string InFileName) |
void | ConditionalMultipleSelectiveImport (string InFileName, int Convert2dB_Scale) |
NOT USED AT MOMENT. | |
void | MultipleImport (string InFileName, int Convert2dB_Scale) |
NOT USED AT MOMENT. | |
void | MultipleUnbiasedImport (string InFileName) |
By JZ Aug 2004. | |
void | WriteFile_pdf (string OutFileName) |
void | WriteFile_cdf (string OutFileName) |
void | WriteFile_cdfc (string OutFileName) |
void | WriteFileQtSamplesBin (string OutFileName) |
Write the number of hits per bin to a file. | |
void | WriteFileBinValues (string OutFileName) |
Write the values in the bins to a file. | |
void | WriteFilePDF (string OutFileName) |
Old code. Do not use! | |
void | WriteFileMaxwell_pdf (string OutFileName, int qtPoints) |
void | WriteFileSndOrderPDV_pdf (string OutFileName, int qtPoints) |
Not used by Reduced Model! | |
void | WriteFileGaussian_pdf (string OutFileName, int qtPoints) |
void | WriteFileGaussian_cdf (string OutFileName, int qtPoints) |
void | WriteFileGaussian_cdfc (string OutFileName, int qtPoints) |
int | GetQtBins (void) |
double | GetMinRange (void) |
double | GetMaxRange (void) |
long | GetQtSamples (void) |
long | GetQtSamplesInRange (void) |
void | SetBin (int NumBin, double ValueBin) |
double | GetBin (int NumBin) |
double | Get_cdfBin (int NumBin) |
double | Get_cdfcBin (int NumBin) |
int | GetIndex_pdf (double vSample) |
long | GetQtSamplesBin (int NumBin) |
double | GetSumLikelihoodRatio (void) |
double | GetMean (void) |
double | GetMeanSquare (void) |
double | GetStdDev (void) |
Get the standard deviation where normalize by qtSamples - 1. | |
double | GetMinSample () |
double | GetMaxSample () |
double | GetSumProbabilities (void) |
Get the sum of all the probabilities. Use for debugging. | |
double | Get_pdfX (int ii) |
double | Get_pdfY (int ii) |
double | Get_pdfConfidence (int ii) |
double | Get_cdfConfidence (int ii) |
double | Get_cdfcConfidence (int ii) |
Private Member Functions | |
void | InitHistogram (int qtBins2, double MinRange2, double MaxRange2) |
Private method called by Histogram constructors. | |
Private Attributes | |
int | ObjectInitialized |
int | Index_pdf |
int | MakeFileWithSamples |
string | FileNameWithSamples |
string | HistInFileName |
Name of the input parameter file for Histogram class. | |
int | qtBins |
The number of bins in the histogram. | |
int | qtBinsLast |
double | MinRange |
The minimum value in the domain of the histogram (double). | |
double | MaxRange |
The maximum value in the domain of the histogram (double). | |
double * | Bin |
double * | BinSquare |
double * | cdfBin |
double * | cdfcBin |
double * | cdfBinSquare |
double * | cdfcBinSquare |
long * | qtSamplesBin |
long | qtSamples |
The total number of samples used to construct the histogram. | |
long | qtSamplesInRange |
The total number of samples that fall in the domain of the histogram. | |
double | SumLikelihoodRatio |
The sum of all likelihood ratios. Used in importance sampling. | |
double | SumUnitaryLikelihoodRatio |
double * | pdfX |
Double array of X-values of pdf. Computed by Obtain_pdf(). | |
double * | pdfY |
double * | pdfConfidence |
Double array giving size of confidence interval. Computed by Obtain_pdf(). | |
int | PreviouslyComputed_pdfConfidenceFlag |
double * | cdfConfidence |
double * | cdfcConfidence |
double | MeanTmp |
double | MeanSquareTmp |
double | MinSample |
The minimum value of all samples. May lie outside domain of histogram! | |
double | MaxSample |
The maximum value of all samples. May lie outside domain of histogram! | |
ofstream * | OutFileWithSamples |
double * | ExpPolynomialCoef |
int | DebugLevel |
DebugLevel = 0 gives no output to LogFile. |
The Histogram class is used to compute statistics.
The Histogram class is used to compute statistics and probability density functions. It can be used for standard Monte Carlo simulations or Monte Carlo simulations with importance sampling
Histogram::Histogram | ( | ) | [inline] |
Vacuous constructor that can be used when constructing an array of Histogram objects
Referenced by MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), MultipleUnbiasedImport(), and MultipleWeightedImport().
Histogram::Histogram | ( | int | qtBins2, | |
double | MinRange2, | |||
double | MaxRange2 | |||
) |
Histogram constructor.
This constructor calls the private method InitHistogram
qtBins2 | The number of bins in the histogram | |
MinRange2 | Minimum value of the domain of the Histogram | |
MaxRange2 | Maximum value of the domain of the Histogram |
References InitHistogram(), MakeFileWithSamples, and ObjectInitialized.
Histogram::Histogram | ( | string | InFileName | ) |
Histogram constructor: Reads parameters from a file.
This constructor reads parameters from the file
InFileName,: | Name of parameter input file (a C++ string) |
This constructor just calls InitHistogram(string InFileName).
References InitHistogram().
Histogram::~Histogram | ( | ) |
void Histogram::AddImportantSample | ( | double | vSample, | |
double | LikelihoodRatio | |||
) |
Adds a sample to the histogram. Used in importance sampling.
Algorithm:
vSample,: | Value of sample to be added (double) | |
LikelihoodRatio,: | Likelihood this sample would occur in a standard Monte Carlo simulation |
References Bin, BinSquare, cdfBin, cdfBinSquare, cdfcBin, cdfcBinSquare, GetIndex_pdf(), Index_pdf, MakeFileWithSamples, MaxRange, MaxSample, MeanSquareTmp, MeanTmp, MinRange, MinSample, OutFileWithSamples, qtBins, qtSamples, qtSamplesBin, qtSamplesInRange, sq(), SumLikelihoodRatio, and SumUnitaryLikelihoodRatio.
Referenced by AddSample(), ConditionalMultipleSelectiveImport(), ImportData(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), MultipleUnbiasedImport(), and MultipleWeightedImport().
void Histogram::AddSample | ( | double | vSample | ) |
Adds a sample to the histogram.
Used for standard Monte Carlo simulation. Calls AddImportantSample with parameter LikelihoodRatio = 1.
vSample,: | the value of the sample to be added (double) |
References AddImportantSample().
Referenced by PulseEvolutionAnalyzer::ComputePulseEnergyStats(), and ImportData().
void Histogram::ClearHistogram | ( | void | ) |
Reinitializes histogram.
References Bin, BinSquare, cdfBin, cdfBinSquare, cdfcBin, cdfcBinSquare, cdfcConfidence, cdfConfidence, MeanSquareTmp, MeanTmp, pdfConfidence, qtBins, qtSamples, qtSamplesBin, qtSamplesInRange, SumLikelihoodRatio, and SumUnitaryLikelihoodRatio.
Referenced by PulseEvolutionAnalyzer::ComputePulseEnergyStats(), ConditionalMultipleSelectiveImport(), InitHistogram(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), MultipleUnbiasedImport(), and MultipleWeightedImport().
void Histogram::ConditionalMultipleSelectiveImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
NOT USED AT MOMENT.
References AddImportantSample(), ClearHistogram(), Linear2dB(), qtSamples, and sgn().
double Histogram::Get_cdfBin | ( | int | NumBin | ) | [inline] |
double Histogram::Get_cdfcBin | ( | int | NumBin | ) | [inline] |
double Histogram::Get_cdfcConfidence | ( | int | ii | ) | [inline] |
Referenced by MergeMultipleConditionalHeuristicBalance(), and MultipleHeuristicBalanceImport().
double Histogram::Get_cdfConfidence | ( | int | ii | ) | [inline] |
Referenced by MergeMultipleConditionalHeuristicBalance(), and MultipleHeuristicBalanceImport().
double Histogram::Get_pdfConfidence | ( | int | ii | ) | [inline] |
double Histogram::Get_pdfX | ( | int | ii | ) | [inline] |
double Histogram::Get_pdfY | ( | int | ii | ) | [inline] |
Referenced by MultipleWeightedImport().
double Histogram::GetBin | ( | int | NumBin | ) | [inline] |
Referenced by MultipleSelectMaxRelNumHitsImport().
int Histogram::GetIndex_pdf | ( | double | vSample | ) |
References MaxRange, MinRange, and qtBins.
Referenced by AddImportantSample().
double Histogram::GetMaxRange | ( | void | ) | [inline] |
double Histogram::GetMaxSample | ( | ) | [inline] |
Referenced by Obtain_pdf().
double Histogram::GetMean | ( | void | ) | [inline] |
double Histogram::GetMeanSquare | ( | void | ) | [inline] |
Referenced by GetStdDev().
double Histogram::GetMinRange | ( | void | ) | [inline] |
double Histogram::GetMinSample | ( | ) | [inline] |
Referenced by Obtain_pdf().
int Histogram::GetQtBins | ( | void | ) | [inline] |
long Histogram::GetQtSamples | ( | void | ) | [inline] |
Referenced by MultipleSelectMaxRelNumHitsImport().
long Histogram::GetQtSamplesBin | ( | int | NumBin | ) | [inline] |
Referenced by MultipleSelectMaxRelNumHitsImport(), and MultipleWeightedImport().
long Histogram::GetQtSamplesInRange | ( | void | ) | [inline] |
double Histogram::GetStdDev | ( | void | ) |
Get the standard deviation where normalize by qtSamples - 1.
References GetMean(), GetMeanSquare(), qtSamples, sq(), and sqrt().
Referenced by WriteFileGaussian_cdf(), WriteFileGaussian_cdfc(), WriteFileGaussian_pdf(), and PulseEvolutionAnalyzer::WriteMeanZerosStdDevOnes().
double Histogram::GetSumLikelihoodRatio | ( | void | ) | [inline] |
double Histogram::GetSumProbabilities | ( | void | ) |
Get the sum of all the probabilities. Use for debugging.
References MaxRange, MinRange, Obtain_pdf(), pdfY, and qtBins.
void Histogram::ImportData | ( | string | InFileName, | |
int | Column, | |||
int | qtColumns | |||
) |
Imports data from a file. Used when merge biased pdfs in importance sampling.
Imports a column of sample data from the file and adds the samples to the Histogram.
InFileName,: | Name of input file (string) | |
Column,: | The index of the column of data to be input | |
qtColumns,: | The number of columns in the file |
References AddSample().
void Histogram::ImportData | ( | string | InFileName | ) |
Imports data from a file. Used when merge biased pdfs in importance sampling.
Imports (Sample,LikelihoodRatio)-pairs from the file.
InFileName,: | The input file name (string) |
References AddImportantSample().
void Histogram::InitHistogram | ( | string | InFileName | ) |
Like Histogram::Histogram(string InFileName), but can be used to initialize an element of an array of Histograms
This method reads parameters from the file
InFileName,: | Name of parameter input file (a C++ string) |
This constructor calls InitHistogram(int qtBins2,double MinRange2, double MaxRange2). It also initializes the flag MakeFileWithSamples and the output file name FileNameWithSamples
References DebugLevel, FileNameWithSamples, HistInFileName, LogFile, LogFileSeparator(), LOWER_AND_UPPER, LOWER_ONLY, MakeFileWithSamples, NO_BOUNDS, ObjectInitialized, OPTIONAL_WARNING, OutFileWithSamples, ReadDouble(), ReadInt(), and ReadString().
Referenced by Histogram().
void Histogram::InitHistogram | ( | int | qtBins2, | |
double | MinRange2, | |||
double | MaxRange2 | |||
) | [private] |
Private method called by Histogram constructors.
Reads in parameters and calls method ClearHistogram
References Bin, BinSquare, cdfBin, cdfBinSquare, cdfcBin, cdfcBinSquare, cdfcConfidence, cdfConfidence, ClearHistogram(), ExpPolynomialCoef, MaxRange, MinRange, ObjectInitialized, pdfConfidence, pdfX, pdfY, PreviouslyComputed_pdfConfidenceFlag, qtBins, qtBinsLast, qtSamplesBin, and ReleaseMemory().
void Histogram::MergeMultipleConditionalHeuristicBalance | ( | string | InFileName, | |
double | z_min, | |||
double | z_max, | |||
double | w_min, | |||
double | w_max, | |||
int | Convert2dB_Scale | |||
) |
Computes the probability density function f(X=x| z_min < Z < z_max, w_min < W < w_max), Samples of the random variables X,Z,W have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
References AddImportantSample(), cdfcConfidence, cdfConfidence, ClearHistogram(), Get_cdfcConfidence(), Get_cdfConfidence(), Get_pdfConfidence(), Histogram(), Linear2dB(), MaxRange, MinRange, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, sq(), and sqrt().
void Histogram::MergeMultipleConditionalHeuristicBalance | ( | string | InFileName, | |
double | z_min, | |||
double | z_max, | |||
int | Convert2dB_Scale | |||
) |
Computes the probability density function f(X=x| z_min < Z < z_max), Samples of the random variables X,Z have been obtained from an importance sampling simulation, and that the names of the files containing the samples are stored in the file InFileName.
References AddImportantSample(), cdfcConfidence, cdfConfidence, ClearHistogram(), Get_cdfcConfidence(), Get_cdfConfidence(), Get_pdfConfidence(), Histogram(), Linear2dB(), MaxRange, MinRange, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, sq(), and sqrt().
void Histogram::MultipleHeuristicBalanceImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
The method of choice for merging in multiple importance sampling.
References AddImportantSample(), cdfcConfidence, cdfConfidence, ClearHistogram(), Get_cdfcConfidence(), Get_cdfConfidence(), Get_pdfConfidence(), Histogram(), Linear2dB(), MaxRange, MinRange, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, sq(), and sqrt().
void Histogram::MultipleImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
NOT USED AT MOMENT.
References AddImportantSample(), ClearHistogram(), Get_pdfConfidence(), Histogram(), Linear2dB(), MaxRange, MinRange, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, sq(), and sqrt().
void Histogram::MultipleSelectiveImport | ( | string | InFileName | ) |
This method appears to be outdated code and is not used by the reduced model
References AddImportantSample(), ClearHistogram(), Get_pdfConfidence(), Histogram(), MaxRange, MinRange, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, sq(), and sqrt().
void Histogram::MultipleSelectMaxRelNumHitsImport | ( | string | InFileName, | |
int | Convert2dB_Scale | |||
) |
Merges biased pdfs created using importance sampling into a single pdf. This is Ivan Lima's Maximum Number of Hits Heuristic.
The biased pdf's are assumed to have been previously generated by calls to methods like Histogram::WriteFile_pdf(string OutFileName).
InFileName,: | Name of file that contains a list of the files containing the biased pdf's. All biased pdf's are assumed to have the same discretized domain. | |
Convert2dB_Scale,: | Flag that specifies whether or not to convert the pdfs to be merged from a linear to dB scale. |
The method does the following:
Next for each bin in the domain of the histograms:
Finally, we normalize the histogram by forcing the number of samples to be 1. This will give us the correct statistics WHY???.
Note that because of the way the histogram has been constructed we can't use the methods GetMean(), GetMax(), GetQtSamples(), etc.
References AddImportantSample(), Bin, cdfBin, cdfcBin, ClearHistogram(), Get_pdfConfidence(), GetBin(), GetQtSamples(), GetQtSamplesBin(), HistInFileName, Histogram(), Linear2dB(), LogFile, Obtain_pdf(), pdfConfidence, PreviouslyComputed_pdfConfidenceFlag, qtBins, qtSamples, qtSamplesInRange, SumLikelihoodRatio, and SumUnitaryLikelihoodRatio.
void Histogram::MultipleUnbiasedImport | ( | string | InFileName | ) |
By JZ Aug 2004.
Imports the data from files created by the histogram class and merge multiple sets of files. This method is useful to merge all the samples of independent unbiased simulations, i.e., we assume LikelihoodRatio=1.0
By: Ivan Lima (12/5/01). Adapted by JZ Aug 2004
References AddImportantSample(), ClearHistogram(), Histogram(), MaxRange, MinRange, Obtain_pdf(), and qtBins.
void Histogram::MultipleWeightedImport | ( | string | InFileName | ) |
NOT USED AT MOMENT.
References AddImportantSample(), Bin, ClearHistogram(), Get_pdfY(), GetQtSamplesBin(), HistInFileName, Histogram(), LogFile, MaxRange, MinRange, Obtain_pdf(), qtBins, qtSamples, qtSamplesInRange, SumLikelihoodRatio, and SumUnitaryLikelihoodRatio.
void Histogram::Obtain_pdf | ( | void | ) |
Converts a histogram into a probability density function (pdf).
This method converts the discrete histogram data into a pdf.
It sets the values of three arrays:
References Bin, BinSquare, cdfBin, cdfBinSquare, cdfcBin, cdfcBinSquare, cdfcConfidence, cdfConfidence, GetMaxSample(), GetMinSample(), MaxRange, MinRange, pdfConfidence, pdfX, pdfY, PreviouslyComputed_pdfConfidenceFlag, qtBins, qtSamples, qtSamplesInRange, sq(), and sqrt().
Referenced by GetSumProbabilities(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), MultipleUnbiasedImport(), MultipleWeightedImport(), WriteFile_cdf(), WriteFile_cdfc(), WriteFile_pdf(), WriteFilePDF(), and WriteFileQtSamplesBin().
void Histogram::ReleaseMemory | ( | void | ) |
Called by destructor ~Histogram().
References Bin, BinSquare, cdfBin, cdfBinSquare, cdfcBin, cdfcBinSquare, cdfcConfidence, cdfConfidence, ExpPolynomialCoef, MakeFileWithSamples, OutFileWithSamples, pdfConfidence, pdfX, pdfY, and qtSamplesBin.
Referenced by InitHistogram(), and ~Histogram().
void Histogram::SetBin | ( | int | NumBin, | |
double | ValueBin | |||
) | [inline] |
void Histogram::SetFileNameWithSamples | ( | string | FileNameWithSamples2 | ) |
References FileNameWithSamples, LogFile, MakeFileWithSamples, and OutFileWithSamples.
void Histogram::WriteFile_cdf | ( | string | OutFileName | ) |
Writes the cumulative density function (cdf) computed by the histogram object to a file
The method first calls Obtain_pdf to compute the pdf
The output file is a matrix of size qtBins by 3:
References cdfBin, cdfConfidence, MaxRange, MinRange, Obtain_pdf(), pdfX, qtBins, and qtSamples.
void Histogram::WriteFile_cdfc | ( | string | OutFileName | ) |
Writes the complement of the cumulative density function (cdf) computed by the histogram object to a file
This method is used in applications to compute outage probabilities!
The method first calls Obtain_pdf to compute the pdf
The output file is a matrix of size qtBins by 3:
References cdfcBin, cdfcConfidence, MaxRange, MinRange, Obtain_pdf(), pdfX, qtBins, and qtSamples.
void Histogram::WriteFile_pdf | ( | string | OutFileName | ) |
Writes the probability density function (pdf) computed by the histogram object to a file
The method first calls Obtain_pdf to compute the pdf
The output file is a matrix of size qtBins by 3:
References Obtain_pdf(), pdfConfidence, pdfX, pdfY, and qtBins.
void Histogram::WriteFileBinValues | ( | string | OutFileName | ) |
void Histogram::WriteFileGaussian_cdf | ( | string | OutFileName, | |
int | qtPoints | |||
) |
void Histogram::WriteFileGaussian_cdfc | ( | string | OutFileName, | |
int | qtPoints | |||
) |
void Histogram::WriteFileGaussian_pdf | ( | string | OutFileName, | |
int | qtPoints | |||
) |
Computes a Gaussian pdf with same mean and standard devaition as Histogram's pdf and writes it to a file
The domain of the Gaussian pdf is the same as the domain of the histogram
OutFileName,: | Name of the output file for the Gaussian pdf | |
qtPoints,: | Number of points in the discretization of the Gaussian pdf |
The first column of the output is the discretized domain of the histogram. The second column are the values of the pdf.
References GetMean(), GetStdDev(), MaxRange, MinRange, pi, sq(), and sqrt().
void Histogram::WriteFileMaxwell_pdf | ( | string | OutFileName, | |
int | qtPoints | |||
) |
Computes a Maxwellian pdf with same mean as Histogram's pdf and writes it to a file
The domain of the Maxwellian pdf is the same as the domain of the histogram
OutFileName,: | Name of the output file for the Maxwellian pdf | |
qtPoints,: | Number of points in the discretization of the Maxwellian pdf |
References cube(), GetMean(), MaxRange, MinRange, pi, sq(), and sqrt().
void Histogram::WriteFilePDF | ( | string | OutFileName | ) |
Old code. Do not use!
References Obtain_pdf(), pdfX, pdfY, qtBins, qtSamples, and qtSamplesInRange.
void Histogram::WriteFileQtSamplesBin | ( | string | OutFileName | ) |
Write the number of hits per bin to a file.
The method first calls Obtain_pdf to compute the pdf
The output file is a matrix of size qtBins by 3:
References Obtain_pdf(), pdfConfidence, pdfX, qtBins, and qtSamplesBin.
void Histogram::WriteFileSndOrderPDV_pdf | ( | string | OutFileName, | |
int | qtPoints | |||
) |
double* Histogram::Bin [private] |
Double array of length qtBins used to store the binned samples of the histogram, weighted by their likelihood.
Each bin of the histogram has an associated indicator function. The indicator function I_i of the i-th bin is a binary function on samples. It takes the value 1 if the sample is placed in the i-th bin and the value 0 otherwise. In other words I_i is a binary random variable. The mean of I_i gives the probability of being in the bin. The standard deviation of I_i is a measure of how close the mean of I_i is to the true value of the pdf. The confidence interval of the i-th bin in a histogram is [mean(I_i) - std_dev(I_i), mean(I_i) + std_dev(I_i)]. There is a large chance that the true probability of being in the i-th bin lies in the confidence interval. So the smaller std_dev(I_i)/mean(I_i) the more accurately the histogram estimates the true pdf.
In standard Monte Carlo the probability of being in [a,b] is the sum over all samples of the indicator function of [a,b] evaluated at the sample, divided by the number of samples.
In importance sampling the probability of being in [a,b] is the sum over all samples of the product of the indicator function of [a,b] evaluated at the sample and the likelihood that the sample would actually occur, divided by the number of samples.
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), MultipleSelectMaxRelNumHitsImport(), MultipleWeightedImport(), Obtain_pdf(), ReleaseMemory(), and WriteFileBinValues().
double* Histogram::BinSquare [private] |
Double array of length qtBins used to store the squares of the binned samples of the histogram, weighted by their likelihood.
Used to compute confidence intervals.
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), Obtain_pdf(), and ReleaseMemory().
double* Histogram::cdfBin [private] |
Integer array containing the number of samples that have been placed in a bin.
For standard Monte Carlo qtSamplesBin[i] = Bin[i], but this is not true for importance sampling, since the binned samples are weighted by their Likelihood ratio.
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), MultipleSelectMaxRelNumHitsImport(), Obtain_pdf(), ReleaseMemory(), and WriteFile_cdf().
double* Histogram::cdfBinSquare [private] |
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), Obtain_pdf(), and ReleaseMemory().
double* Histogram::cdfcBin [private] |
double* Histogram::cdfcBinSquare [private] |
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), Obtain_pdf(), and ReleaseMemory().
double* Histogram::cdfcConfidence [private] |
double* Histogram::cdfConfidence [private] |
int Histogram::DebugLevel [private] |
DebugLevel = 0 gives no output to LogFile.
Referenced by InitHistogram().
double* Histogram::ExpPolynomialCoef [private] |
Referenced by InitHistogram(), and ReleaseMemory().
string Histogram::FileNameWithSamples [private] |
Name of the output file to which (sample,likelihood ratio)-pairs are written. Used in importance sampling.
Referenced by InitHistogram(), and SetFileNameWithSamples().
string Histogram::HistInFileName [private] |
Name of the input parameter file for Histogram class.
Referenced by InitHistogram(), MultipleSelectMaxRelNumHitsImport(), and MultipleWeightedImport().
int Histogram::Index_pdf [private] |
Referenced by AddImportantSample().
int Histogram::MakeFileWithSamples [private] |
Flag that controls whether (sample,likelihood ratio)-pairs are written to the output file named string FileNameWithSamples. Used in importance sampling
Referenced by AddImportantSample(), Histogram(), InitHistogram(), ReleaseMemory(), and SetFileNameWithSamples().
double Histogram::MaxRange [private] |
The maximum value in the domain of the histogram (double).
Referenced by AddImportantSample(), GetIndex_pdf(), GetSumProbabilities(), InitHistogram(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleUnbiasedImport(), MultipleWeightedImport(), Obtain_pdf(), WriteFile_cdf(), WriteFile_cdfc(), WriteFileGaussian_cdf(), WriteFileGaussian_cdfc(), WriteFileGaussian_pdf(), WriteFileMaxwell_pdf(), and WriteFileSndOrderPDV_pdf().
double Histogram::MaxSample [private] |
The maximum value of all samples. May lie outside domain of histogram!
Referenced by AddImportantSample().
double Histogram::MeanSquareTmp [private] |
Referenced by AddImportantSample(), and ClearHistogram().
double Histogram::MeanTmp [private] |
Referenced by AddImportantSample(), and ClearHistogram().
double Histogram::MinRange [private] |
The minimum value in the domain of the histogram (double).
Referenced by AddImportantSample(), GetIndex_pdf(), GetSumProbabilities(), InitHistogram(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleUnbiasedImport(), MultipleWeightedImport(), Obtain_pdf(), WriteFile_cdf(), WriteFile_cdfc(), WriteFileGaussian_cdf(), WriteFileGaussian_cdfc(), WriteFileGaussian_pdf(), WriteFileMaxwell_pdf(), and WriteFileSndOrderPDV_pdf().
double Histogram::MinSample [private] |
The minimum value of all samples. May lie outside domain of histogram!
Referenced by AddImportantSample().
int Histogram::ObjectInitialized [private] |
Referenced by Histogram(), and InitHistogram().
ofstream* Histogram::OutFileWithSamples [private] |
Referenced by AddImportantSample(), InitHistogram(), ReleaseMemory(), and SetFileNameWithSamples().
double* Histogram::pdfConfidence [private] |
Double array giving size of confidence interval. Computed by Obtain_pdf().
The confidence intervals are not computed in all cases.
Referenced by ClearHistogram(), InitHistogram(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), Obtain_pdf(), ReleaseMemory(), WriteFile_pdf(), and WriteFileQtSamplesBin().
double* Histogram::pdfX [private] |
Double array of X-values of pdf. Computed by Obtain_pdf().
Referenced by InitHistogram(), Obtain_pdf(), ReleaseMemory(), WriteFile_cdf(), WriteFile_cdfc(), WriteFile_pdf(), WriteFileBinValues(), WriteFilePDF(), and WriteFileQtSamplesBin().
double* Histogram::pdfY [private] |
Double array of Y-values of pdf. Computed by Obtain_pdf()
Referenced by GetSumProbabilities(), InitHistogram(), Obtain_pdf(), ReleaseMemory(), WriteFile_pdf(), and WriteFilePDF().
int Histogram::PreviouslyComputed_pdfConfidenceFlag [private] |
int Histogram::qtBins [private] |
The number of bins in the histogram.
Referenced by AddImportantSample(), ClearHistogram(), GetIndex_pdf(), GetSumProbabilities(), InitHistogram(), MergeMultipleConditionalHeuristicBalance(), MultipleHeuristicBalanceImport(), MultipleImport(), MultipleSelectiveImport(), MultipleSelectMaxRelNumHitsImport(), MultipleUnbiasedImport(), MultipleWeightedImport(), Obtain_pdf(), WriteFile_cdf(), WriteFile_cdfc(), WriteFile_pdf(), WriteFileBinValues(), WriteFilePDF(), and WriteFileQtSamplesBin().
int Histogram::qtBinsLast [private] |
Referenced by InitHistogram().
long Histogram::qtSamples [private] |
The total number of samples used to construct the histogram.
Referenced by AddImportantSample(), ClearHistogram(), ConditionalMultipleSelectiveImport(), GetStdDev(), MultipleSelectMaxRelNumHitsImport(), MultipleWeightedImport(), Obtain_pdf(), WriteFile_cdf(), WriteFile_cdfc(), and WriteFilePDF().
long* Histogram::qtSamplesBin [private] |
Referenced by AddImportantSample(), ClearHistogram(), InitHistogram(), ReleaseMemory(), and WriteFileQtSamplesBin().
long Histogram::qtSamplesInRange [private] |
The total number of samples that fall in the domain of the histogram.
Referenced by AddImportantSample(), ClearHistogram(), MultipleSelectMaxRelNumHitsImport(), MultipleWeightedImport(), Obtain_pdf(), and WriteFilePDF().
double Histogram::SumLikelihoodRatio [private] |
The sum of all likelihood ratios. Used in importance sampling.
Referenced by AddImportantSample(), ClearHistogram(), MultipleSelectMaxRelNumHitsImport(), and MultipleWeightedImport().
double Histogram::SumUnitaryLikelihoodRatio [private] |
Used only in standard Monte Carlo. Is the same as number of samples. Not used in code.
Referenced by AddImportantSample(), ClearHistogram(), MultipleSelectMaxRelNumHitsImport(), and MultipleWeightedImport().