SedSat3 1.1.6
Sediment Source Apportionment Tool - Advanced statistical methods for environmental pollution research
Loading...
Searching...
No Matches
MultipleLinearRegression Class Reference

#include </home/runner/work/SedSat3/SedSat3/multiplelinearregression.h>

Inheritance diagram for MultipleLinearRegression:
Inheritance graph
Collaboration diagram for MultipleLinearRegression:
Collaboration graph

Public Member Functions

 MultipleLinearRegression ()
 MultipleLinearRegression (const MultipleLinearRegression &mp)
MultipleLinearRegression & operator= (const MultipleLinearRegression &mp)
double Regress (const vector< vector< double > > &independent, const vector< double > &dependent, const vector< string > &indep_vars_names)
double SSE_reduced_model (const vector< vector< double > > &independent, const vector< double > &dependent, int eliminated_var)
QJsonObject toJsonObject () const override
 Serialize object to JSON format.
string ToString () const override
 Convert object to string representation.
bool ReadFromJsonObject (const QJsonObject &jsonobject) override
 Deserialize object from JSON format.
vector< double > CoefficientsIntercept () const
vector< string > & GetIndependentVariableNames ()
vector< string > GetIndependentVariableNames () const
vector< double > & IndependentData (const string &var_name)
vector< double > & DependentData ()
double MeanIndependentVar (int i)
double GeoMeanIndependentVar (int i)
string DependentVariableName ()
void SetDependentVariableName (const string &name)
vector< double > P_Value ()
void SetEffective (int i, bool eff)
bool Effective (int i) const
regression_form Equation () const
void SetEquation (regression_form form)
void SetPValueThreshold (const double &p)
double PValueThreshold ()
Public Member Functions inherited from Interface
 Interface ()
 Default constructor.
 Interface (const Interface &intf)
 Copy constructor.
Interface & operator= (const Interface &intf)
 Assignment operator.
virtual bool writetofile (QFile *file)
 Write object data to a file.
virtual bool Read (const QStringList &strlist)
 Parse object data from a string list.
virtual QTableWidget * ToTable ()
 Create a Qt table widget representation of the data.
string GetNotes () const
 Get the notes/annotations associated with this object.
void SetNotes (const string &note)
 Set the notes for this object, replacing any existing notes.
void AppendtoNotes (const string &note)
 Append a note to existing notes.
void ClearNotes ()
 Clear all notes associated with this object.
void SetLimit (_range lowhigh, const double &value)
 Set upper or lower limit for value highlighting.
void SetOption (options_key opt, bool val)
 Set a configuration option.
bool Option (options_key opt)
 Get the current value of a configuration option.
options & GetOptions ()
 Get reference to the options structure.
QString XAxisLabel () const
 Get the X-axis label.
QString YAxisLabel () const
 Get the Y-axis label.
bool SetXAxisLabel (const QString &label)
 Set the X-axis label.
bool SetYAxisLabel (const QString &label)
 Set the Y-axis label.

Private Attributes

vector< double > coefficients_intercept_
vector< vector< double > > independent_data
vector< double > dependent_data
string dependent_variable_name
vector< string > independent_variables_names
CMBMatrix correlation_matrix_
double chisq {}
double R2 {}
double R2_adj {}
vector< double > p_value
double p_value_threshold = 0.05
vector< bool > make_effective
regression_form regressionEquation = regression_form::linear

Additional Inherited Members

Public Attributes inherited from Interface
double lowlimit {}
 Lower threshold for value highlighting (when enabled).
double highlimit {}
 Upper threshold for value highlighting (when enabled).
bool highlightoutsideoflimit = false
 Flag indicating whether to highlight values outside defined limits.

Detailed Description

Definition at line 12 of file multiplelinearregression.h.

Constructor & Destructor Documentation

◆ MultipleLinearRegression() [1/2]

MultipleLinearRegression::MultipleLinearRegression ( )

Definition at line 12 of file multiplelinearregression.cpp.

References Interface::Interface().

Referenced by MultipleLinearRegression(), and operator=().

◆ MultipleLinearRegression() [2/2]

Member Function Documentation

◆ CoefficientsIntercept()

vector< double > MultipleLinearRegression::CoefficientsIntercept ( ) const

Definition at line 324 of file multiplelinearregression.cpp.

References coefficients_intercept_.

◆ DependentData()

vector< double > & MultipleLinearRegression::DependentData ( )
inline

Definition at line 32 of file multiplelinearregression.h.

References dependent_data.

◆ DependentVariableName()

string MultipleLinearRegression::DependentVariableName ( )
inline

Definition at line 38 of file multiplelinearregression.h.

References dependent_variable_name.

◆ Effective()

bool MultipleLinearRegression::Effective ( int i) const
inline

Definition at line 42 of file multiplelinearregression.h.

References make_effective.

Referenced by toJsonObject().

◆ Equation()

regression_form MultipleLinearRegression::Equation ( ) const
inline

Definition at line 43 of file multiplelinearregression.h.

References regressionEquation.

◆ GeoMeanIndependentVar()

double MultipleLinearRegression::GeoMeanIndependentVar ( int i)

Definition at line 335 of file multiplelinearregression.cpp.

References independent_data.

◆ GetIndependentVariableNames() [1/2]

vector< string > & MultipleLinearRegression::GetIndependentVariableNames ( )
inline

◆ GetIndependentVariableNames() [2/2]

vector< string > MultipleLinearRegression::GetIndependentVariableNames ( ) const
inline

Definition at line 27 of file multiplelinearregression.h.

References independent_variables_names.

◆ IndependentData()

vector< double > & MultipleLinearRegression::IndependentData ( const string & var_name)

Definition at line 366 of file multiplelinearregression.cpp.

References independent_data, and independent_variables_names.

◆ MeanIndependentVar()

double MultipleLinearRegression::MeanIndependentVar ( int i)

Definition at line 330 of file multiplelinearregression.cpp.

References independent_data.

◆ operator=()

◆ P_Value()

vector< double > MultipleLinearRegression::P_Value ( )
inline

Definition at line 40 of file multiplelinearregression.h.

References p_value.

◆ PValueThreshold()

double MultipleLinearRegression::PValueThreshold ( )
inline

Definition at line 50 of file multiplelinearregression.h.

References p_value_threshold.

◆ ReadFromJsonObject()

bool MultipleLinearRegression::ReadFromJsonObject ( const QJsonObject & jsonobject)
overridevirtual

Deserialize object from JSON format.

Parameters
jsonobjectThe JSON object to read from
Returns
true if deserialization was successful, false otherwise

Pure virtual method for JSON deserialization. Derived classes must implement this to reconstruct their data structure from a JSON object.

Warning
Implementations should validate JSON structure and handle missing fields gracefully

Reimplemented from Interface.

Definition at line 273 of file multiplelinearregression.cpp.

References chisq, coefficients_intercept_, dependent_data, independent_data, independent_variables_names, linear, make_effective, p_value, power, R2, R2_adj, and regressionEquation.

Referenced by MultipleLinearRegressionSet::ReadFromJsonObject().

◆ Regress()

double MultipleLinearRegression::Regress ( const vector< vector< double > > & independent,
const vector< double > & dependent,
const vector< string > & indep_vars_names )

◆ SetDependentVariableName()

void MultipleLinearRegression::SetDependentVariableName ( const string & name)
inline

◆ SetEffective()

void MultipleLinearRegression::SetEffective ( int i,
bool eff )
inline

Definition at line 41 of file multiplelinearregression.h.

References make_effective.

Referenced by SourceSinkData::PerformRegressionVsOMAndSize().

◆ SetEquation()

void MultipleLinearRegression::SetEquation ( regression_form form)
inline

◆ SetPValueThreshold()

void MultipleLinearRegression::SetPValueThreshold ( const double & p)
inline

Definition at line 47 of file multiplelinearregression.h.

References p_value_threshold.

Referenced by Elemental_Profile_Set::BuildRegressionModel().

◆ SSE_reduced_model()

double MultipleLinearRegression::SSE_reduced_model ( const vector< vector< double > > & independent,
const vector< double > & dependent,
int eliminated_var )

Definition at line 53 of file multiplelinearregression.cpp.

References linear, log, regressionEquation, and y.

Referenced by Regress().

◆ toJsonObject()

QJsonObject MultipleLinearRegression::toJsonObject ( ) const
overridevirtual

Serialize object to JSON format.

Returns
QJsonObject containing the serialized data

Pure virtual method for JSON serialization. Derived classes must implement this to convert their data structure to a JSON object suitable for saving to .json files or transmitting over network.

Note
The JSON structure is determined by the derived class

Reimplemented from Interface.

Definition at line 228 of file multiplelinearregression.cpp.

References chisq, coefficients_intercept_, dependent_data, Effective(), independent_data, independent_variables_names, linear, p_value, R2, R2_adj, and regressionEquation.

◆ ToString()

string MultipleLinearRegression::ToString ( ) const
overridevirtual

Convert object to string representation.

Returns
String representation of the object's data

Pure virtual method that must be implemented by derived classes to provide a human-readable string representation of their data. Typically used for text file export or debugging.

Note
Format is determined by the derived class implementation

Reimplemented from Interface.

Definition at line 339 of file multiplelinearregression.cpp.

References chisq, coefficients_intercept_, independent_variables_names, linear, p_value, R2, R2_adj, and regressionEquation.

Member Data Documentation

◆ chisq

double MultipleLinearRegression::chisq {}
private

◆ coefficients_intercept_

vector<double> MultipleLinearRegression::coefficients_intercept_
private

◆ correlation_matrix_

CMBMatrix MultipleLinearRegression::correlation_matrix_
private

Definition at line 60 of file multiplelinearregression.h.

Referenced by MultipleLinearRegression(), operator=(), and Regress().

◆ dependent_data

vector<double> MultipleLinearRegression::dependent_data
private

◆ dependent_variable_name

string MultipleLinearRegression::dependent_variable_name
private

◆ independent_data

vector<vector<double> > MultipleLinearRegression::independent_data
private

◆ independent_variables_names

◆ make_effective

vector<bool> MultipleLinearRegression::make_effective
private

◆ p_value

vector<double> MultipleLinearRegression::p_value
private

◆ p_value_threshold

double MultipleLinearRegression::p_value_threshold = 0.05
private

◆ R2

double MultipleLinearRegression::R2 {}
private

◆ R2_adj

double MultipleLinearRegression::R2_adj {}
private

◆ regressionEquation


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