Dakota  Version
Explore and Predict with Confidence
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SensAnalysisGlobal Class Reference

Class for a utility class containing correlation calculations and variance-based decomposition. More...

Public Member Functions

 SensAnalysisGlobal ()
 constructor
 
 ~SensAnalysisGlobal ()
 destructor
 
void compute_correlations (const VariablesArray &vars_samples, const IntResponseMap &resp_samples, const StringSetArray &dss_vals)
 computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank More...
 
void compute_correlations (const RealMatrix &vars_samples, const IntResponseMap &resp_samples)
 computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank More...
 
void archive_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id=0) const
 save correlations to database
 
void archive_std_regress_coeffs (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id=0) const
 save standardized regression coefficients to database
 
bool correlations_computed () const
 returns corrComputed to indicate whether compute_correlations() has been invoked
 
void print_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels) const
 prints the correlations computed in compute_correlations()
 
void compute_std_regress_coeffs (const RealMatrix &vars_samples, const IntResponseMap &resp_samples)
 computes standardized regression coefficients and corresponding R^2 values for input and output data
 
void print_std_regress_coeffs (std::ostream &s, StringArray var_labels, const StringArray &resp_labels) const
 prints the SRCs and R^2 values computed in compute_correlations()
 

Private Member Functions

size_t find_valid_samples (const IntResponseMap &resp_samples, BoolDeque &valid_sample)
 find samples with finite response (any sample with any Nan or +/-Inf observation will be dropped)
 
void valid_sample_matrix (const VariablesArray &vars_samples, const IntResponseMap &resp_samples, const StringSetArray &dss_vals, const BoolDeque is_valid_sample, RealMatrix &valid_data)
 extract a compact valid sample (vars/resp) matrix from the passed data
 
void valid_sample_matrix (const RealMatrix &vars_samples, const IntResponseMap &resp_samples, const BoolDeque is_valid_sample, RealMatrix &valid_samples)
 extract a compact valid sample (vars/resp) matrix from the passed data
 
void values_to_ranks (RealMatrix &valid_data)
 replace sample values with their ranks, in-place More...
 
void correl_adjust (Real &corr_value)
 if result was NaN/Inf, preserve it, otherwise truncate to [-1.0, 1.0]
 
void simple_corr (RealMatrix &total_data, const int &num_in, RealMatrix &corr_matrix)
 computes simple correlations, populating corr_matrix More...
 
void partial_corr (RealMatrix &total_data, const int num_in, const RealMatrix &simple_corr_mat, RealMatrix &corr_matrix, bool &numerical_issues)
 computes partial correlations, populating corr_matrix and numerical_issues More...
 
bool has_nan_or_inf (const RealMatrix &corr) const
 Return true if there are any NaN or Inf entries in the matrix.
 
void check_correlations_for_nan_or_inf (std::ostream &s) const
 Check correlation matrices for nans or infs and print warning message.
 
void print_simple_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, bool rank) const
 print simple (rank = false) or simple rank (rank = true) correlations
 
void print_partial_correlations (std::ostream &s, const StringArray &var_labels, const StringArray &resp_labels, bool rank) const
 print partial (rank = false) or partial rank (rank = true) correlations
 
void archive_simple_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const std::vector< const char * > &combined_desc, const size_t &inc_id, bool rank) const
 archive simple (rank = false) or simple rank (rank = true) correlations
 
void archive_partial_correlations (const StrStrSizet &run_identifier, ResultsManager &iterator_results, const StringArray &var_labels, const StringArray &resp_labels, const size_t &inc_id, bool rank) const
 archive partial (rank = false) or partial rank (rank = true) correlations
 

Static Private Member Functions

static bool rank_sort (const int &x, const int &y)
 sort algorithm to compute ranks for rank correlations
 

Private Attributes

RealMatrix simpleCorr
 matrix to hold simple raw correlations
 
RealMatrix simpleRankCorr
 matrix to hold simple rank correlations
 
RealMatrix partialCorr
 matrix to hold partial raw correlations
 
RealMatrix partialRankCorr
 matrix to hold partial rank correlations
 
RealMatrix stdRegressCoeffs
 matrix to hold standardized regression coefficients
 
RealVector stdRegressCODs
 vector to hold coefficients of determination, eg R^2 values
 
size_t numFns
 number of responses
 
size_t numVars
 number of inputs
 
bool numericalIssuesRaw
 flag indicating numerical issues in partial raw correlation calculations
 
bool numericalIssuesRank
 flag indicating numerical issues in partial rank correlation calculations
 
bool corrComputed
 flag indictaing whether correlations have been computed
 

Static Private Attributes

static RealArray rawData = RealArray()
 array to hold temporary data before sort
 

Detailed Description

Class for a utility class containing correlation calculations and variance-based decomposition.

This class provides code for several of the sampling methods both in the NonD branch and in the PStudyDACE branch. Currently, the utility functions provide global sensitivity analysis through correlation calculations (e.g. simple, partial, rank, raw) as well as variance-based decomposition.

Member Function Documentation

◆ compute_correlations() [1/2]

void compute_correlations ( const VariablesArray &  vars_samples,
const IntResponseMap &  resp_samples,
const StringSetArray &  dss_vals 
)

◆ compute_correlations() [2/2]

void compute_correlations ( const RealMatrix &  vars_samples,
const IntResponseMap &  resp_samples 
)

computes four correlation matrices for input and output data simple, partial, simple rank, and partial rank

This version is used when compact samples matrix is being processed. Calculates simple correlation, partial correlation, simple rank correlation, and partial rank correlation coefficients.

References Dakota::abort_handler(), SensAnalysisGlobal::corrComputed, SensAnalysisGlobal::find_valid_samples(), SensAnalysisGlobal::numericalIssuesRank, SensAnalysisGlobal::numericalIssuesRaw, SensAnalysisGlobal::numFns, SensAnalysisGlobal::numVars, SensAnalysisGlobal::partial_corr(), SensAnalysisGlobal::partialCorr, SensAnalysisGlobal::partialRankCorr, SensAnalysisGlobal::simple_corr(), SensAnalysisGlobal::simpleCorr, SensAnalysisGlobal::simpleRankCorr, SensAnalysisGlobal::valid_sample_matrix(), and SensAnalysisGlobal::values_to_ranks().

◆ values_to_ranks()

void values_to_ranks ( RealMatrix &  valid_data)
private

replace sample values with their ranks, in-place

When converting values to ranks, uses the average ranks of any tied values

Referenced by SensAnalysisGlobal::compute_correlations().

◆ simple_corr()

void simple_corr ( RealMatrix &  total_data,
const int &  num_in,
RealMatrix &  corr_matrix 
)
private

computes simple correlations, populating corr_matrix

Calculates simple correlation coefficients from a matrix of data (oriented factors x observations):

  • num_corr is number of rows of total data
  • num_in indicates whether only pairs of correlations should be calculated between pairs of columns (num_in vs. num_corr-num_in); if num_in = num_corr, correlations are calculated between all columns

References Dakota::center_matrix_rows(), and SensAnalysisGlobal::correl_adjust().

Referenced by SensAnalysisGlobal::compute_correlations().

◆ partial_corr()

void partial_corr ( RealMatrix &  total_data,
const int  num_in,
const RealMatrix &  simple_corr_mat,
RealMatrix &  corr_matrix,
bool &  numerical_issues 
)
private

computes partial correlations, populating corr_matrix and numerical_issues

Calculates partial correlation coefficients between num_in inputs and numRows() - num_in outputs.

References Dakota::abort_handler(), Dakota::center_matrix_rows(), SensAnalysisGlobal::correl_adjust(), Dakota::qr(), Dakota::qr_rsolve(), and Dakota::svd().

Referenced by SensAnalysisGlobal::compute_correlations().


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