|
SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
|
Represents a model parameter with prior distribution and constraints. More...
#include <parameter.h>

Public Member Functions | |
| Parameter () | |
| Default constructor. | |
| Parameter (const Parameter ¶m) | |
| Copy constructor. | |
| Parameter & | operator= (const Parameter ¶m) |
| Assignment operator. | |
| void | SetPriorDistribution (distribution_type dist_type) |
| Set the type of prior probability distribution. | |
| Distribution & | GetPriorDistribution () |
| Get reference to the prior distribution object. | |
| bool | operator== (const string &dist_type) |
| Compare parameter with a string (unused, legacy method) | |
| double | GetVal (const string &quantity) |
| Get range bound by string identifier. | |
| void | SetRange (const vector< double > &rng) |
| Set the parameter range from a vector. | |
| void | SetRange (double low, double high) |
| Set the parameter range from individual bounds. | |
| double | GetRange (_range lowhigh) |
| Get a specific range bound. | |
| void | SetRange (_range, double value) |
| Set a specific range bound. | |
| void | SetName (const string &nam) |
| Set the parameter name/identifier. | |
| string | Name () const |
| Get the parameter name. | |
| double | Value () const |
| Get the current parameter value. | |
| void | SetValue (double val) |
| Set the current parameter value. | |
| double | GetValue () |
| Get the current parameter value (alternative accessor) | |
| void | UpdatePriorDistribution () |
| Update prior distribution parameters based on current range. | |
| double | CalcLogPriorProbability (const double x) |
| Calculate log prior probability density at a given value. | |
Private Attributes | |
| Distribution | prior_distribution |
| The prior probability distribution for this parameter. | |
| vector< double > | range |
| Allowable range for the parameter [low, high]. | |
| string | name |
| Parameter name/identifier. | |
| double | value = 0 |
| Current value of the parameter. | |
Represents a model parameter with prior distribution and constraints.
The Parameter class encapsulates a single model parameter used in statistical inference, optimization, and uncertainty quantification. It stores:
This class is fundamental to SedSat3's statistical approaches:
Parameters typically represent source contributions in sediment fingerprinting, with values constrained between 0 and 1 (or 0-100%), and prior distributions reflecting expert knowledge or constraints from the mixing model.
The class automatically parameterizes prior distributions based on the specified range using UpdatePriorDistribution():
This automatic parameterization ensures that approximately 95% of the prior probability mass falls within the specified range (assuming ±2σ coverage).
Example usage:
Definition at line 72 of file parameter.h.
| Parameter::Parameter | ( | ) |
Default constructor.
Initializes a Parameter object with:
Definition at line 3 of file parameter.cpp.
References range.
| Parameter::Parameter | ( | const Parameter & | param | ) |
Copy constructor.
| param | The Parameter object to copy from |
Creates a deep copy of another Parameter, including:
Definition at line 58 of file parameter.cpp.
References name, prior_distribution, and range.
| double Parameter::CalcLogPriorProbability | ( | const double | x | ) |
Calculate log prior probability density at a given value.
| x | The value at which to evaluate the log prior probability |
Evaluates ln(p(x)) where p is the prior probability density function. Used in Bayesian inference to calculate:
Using log probabilities prevents numerical underflow and is computationally more stable for MCMC sampling.
Example:
Definition at line 90 of file parameter.cpp.
References Distribution::EvalLog(), prior_distribution, and x.
|
inline |
Get reference to the prior distribution object.
Provides direct access to the prior distribution for:
Definition at line 144 of file parameter.h.
References prior_distribution.
| double Parameter::GetRange | ( | _range | lowhigh | ) |
Get a specific range bound.
| lowhigh | Specifies which bound to retrieve |
Type-safe method for retrieving range bounds.
Definition at line 25 of file parameter.cpp.
| double Parameter::GetVal | ( | const string & | quantity | ) |
Get range bound by string identifier.
| quantity | String specifying which bound: "high" or "low" |
Legacy method providing string-based access to range bounds. Prefer using GetRange(_range) for type-safe access.
Definition at line 8 of file parameter.cpp.
References range.
|
inline |
Get the current parameter value (alternative accessor)
Definition at line 284 of file parameter.h.
References value.
|
inline |
Get the parameter name.
Definition at line 248 of file parameter.h.
References name.
Referenced by SourceSinkData::GetParameterName().
Assignment operator.
| param | The Parameter object to copy from |
Copies all data from another Parameter object.
Definition at line 65 of file parameter.cpp.
References name, prior_distribution, and range.
| bool Parameter::operator== | ( | const string & | dist_type | ) |
Compare parameter with a string (unused, legacy method)
| dist_type | String to compare with |
|
inline |
Set the parameter name/identifier.
| nam | The parameter name (e.g., "Agricultural_Contribution", "Forest_Source") |
Parameter names are used for:
Definition at line 240 of file parameter.h.
References name.
Referenced by SourceSinkData::InitializeParametersAndObservations().
|
inline |
Set the type of prior probability distribution.
| dist_type | The distribution type to use |
Sets the prior distribution type (e.g., normal, lognormal, uniform). Call UpdatePriorDistribution() or SetRange() after this to parameterize the distribution based on the current range.
Example:
Definition at line 128 of file parameter.h.
References Distribution::distribution, and prior_distribution.
Referenced by SourceSinkData::InitializeParametersAndObservations().
| void Parameter::SetRange | ( | _range | lowhigh, |
| double | value | ||
| ) |
Set a specific range bound.
| lowhigh | Specifies which bound to set (low or high) |
| value | The new bound value |
Sets one bound of the range while leaving the other unchanged. Automatically updates the prior distribution parameters to reflect the new range.
Example:
Definition at line 36 of file parameter.cpp.
References low, range, UpdatePriorDistribution(), and value.
| void Parameter::SetRange | ( | const vector< double > & | rng | ) |
Set the parameter range from a vector.
| rng | Vector containing [low_bound, high_bound] |
Sets both range bounds from a 2-element vector and automatically updates the prior distribution parameters to match the new range.
Definition at line 18 of file parameter.cpp.
References range, and UpdatePriorDistribution().
Referenced by SourceSinkData::InitializeParametersAndObservations().
| void Parameter::SetRange | ( | double | low, |
| double | high | ||
| ) |
Set the parameter range from individual bounds.
| low | Lower bound of the allowable range |
| high | Upper bound of the allowable range |
Sets the parameter's feasible range and automatically updates the prior distribution parameters. This is the preferred method for setting ranges.
Example:
Definition at line 48 of file parameter.cpp.
References high, low, range, and UpdatePriorDistribution().
|
inline |
Set the current parameter value.
| val | The new value |
Sets the parameter's current value, typically during:
Definition at line 274 of file parameter.h.
References value.
| void Parameter::UpdatePriorDistribution | ( | ) |
Update prior distribution parameters based on current range.
Automatically parameterizes the prior distribution to be consistent with the specified range. Called automatically by SetRange methods.
Normal Distribution:
Lognormal Distribution:
Other Distributions:
Definition at line 73 of file parameter.cpp.
References Distribution::distribution, log, lognormal, normal, Distribution::parameters, prior_distribution, and range.
Referenced by SetRange(), SetRange(), and SetRange().
|
inline |
Get the current parameter value.
Definition at line 258 of file parameter.h.
References value.
Referenced by SourceSinkData::GetElementDistributionMuValue(), SourceSinkData::GetElementDistributionSigmaValue(), and SourceSinkData::GetSourceContributions().
|
private |
Parameter name/identifier.
Human-readable name used for display, reporting, and identification. Examples: "Agricultural", "Forest", "Urban", "Geological_Baseline"
Definition at line 381 of file parameter.h.
Referenced by Parameter(), Name(), operator=(), and SetName().
|
private |
The prior probability distribution for this parameter.
Encodes prior knowledge or beliefs about the parameter's likely values before observing data. Used in Bayesian inference to constrain the posterior distribution.
The distribution is automatically parameterized by UpdatePriorDistribution() based on the specified range for normal and lognormal distributions.
Definition at line 357 of file parameter.h.
Referenced by Parameter(), CalcLogPriorProbability(), GetPriorDistribution(), operator=(), SetPriorDistribution(), and UpdatePriorDistribution().
|
private |
Allowable range for the parameter [low, high].
Two-element vector defining the feasible region for optimization and sampling. For source contributions, typically [0.0, 1.0] or [0.0, 100.0].
Range bounds serve multiple purposes:
Definition at line 373 of file parameter.h.
Referenced by Parameter(), Parameter(), GetRange(), GetVal(), operator=(), SetRange(), SetRange(), SetRange(), and UpdatePriorDistribution().
|
private |
Current value of the parameter.
The current estimate or sample value. Updated during:
Default value is 0.0 after construction.
Definition at line 393 of file parameter.h.
Referenced by GetValue(), SetRange(), SetValue(), and Value().