SAGA API
v9.6
|
#include <mat_tools.h>
Public Member Functions | |
CSG_Regression_Multiple (bool bIntercept=true) | |
virtual | ~CSG_Regression_Multiple (void) |
void | Destroy (void) |
bool | Set_Data (const CSG_Matrix &Samples, CSG_Strings *pNames=NULL) |
void | Set_With_Intercept (bool bOn=true) |
bool | Get_With_Intercept (void) const |
bool | Get_Model (const CSG_Matrix &Samples, CSG_Strings *pNames=NULL) |
bool | Get_Model_Forward (const CSG_Matrix &Samples, double P_in, CSG_Strings *pNames=NULL) |
bool | Get_Model_Backward (const CSG_Matrix &Samples, double P_out, CSG_Strings *pNames=NULL) |
bool | Get_Model_Stepwise (const CSG_Matrix &Samples, double P_in, double P_out, CSG_Strings *pNames=NULL) |
bool | Get_Model (void) |
bool | Get_Model_Forward (double P_in) |
bool | Get_Model_Backward (double P_out) |
bool | Get_Model_Stepwise (double P_in, double P_out) |
bool | Get_CrossValidation (int nSubSamples=0) |
CSG_String | Get_Info (void) const |
class CSG_Table * | Get_Info_Regression (void) const |
class CSG_Table * | Get_Info_Model (void) const |
class CSG_Table * | Get_Info_Steps (void) const |
double | Get_R2 (void) const |
double | Get_R2_Adj (void) const |
double | Get_StdError (void) const |
double | Get_F (void) const |
double | Get_P (void) const |
double | Get_CV_RMSE (void) const |
double | Get_CV_NRMSE (void) const |
double | Get_CV_R2 (void) const |
int | Get_CV_nSamples (void) const |
int | Get_DegFreedom (void) const |
int | Get_nSamples (void) const |
int | Get_nPredictors (void) const |
int | Get_Predictor (int i) const |
double | Get_RConst (void) const |
const SG_Char * | Get_Name (int iVariable) const |
double | Get_ID (int iVariable) const |
double | Get_RCoeff (int iVariable) const |
double | Get_R2_Partial (int iVariable) const |
double | Get_R2_Partial_Adj (int iVariable) const |
double | Get_StdError (int iVariable) const |
double | Get_T (int iVariable) const |
double | Get_P (int iVariable) const |
double | Get_Parameter (int iVariable, int Parameter) const |
double | Get_Value (const CSG_Vector &Predictors) const |
bool | Get_Value (const CSG_Vector &Predictors, double &Value) const |
double | Get_Residual (int iSample) const |
bool | Get_Residual (int iSample, double &Residual) const |
bool | Get_Residuals (CSG_Vector &Residuals) const |
Protected Member Functions | |
bool | _Initialize (bool bInclude) |
double | _Get_F (int nPredictors, int nSamples, double r2_full, double r2_reduced) |
double | _Get_P (int nPredictors, int nSamples, double r2_full, double r2_reduced) |
bool | _Get_Regression (const class CSG_Matrix &Samples) |
int | _Get_Step_In (CSG_Matrix &X, double P_in, double &R2, const CSG_Matrix &Samples) |
int | _Get_Step_Out (CSG_Matrix &X, double P_out, double &R2) |
bool | _Set_Step_Info (const CSG_Matrix &X) |
bool | _Set_Step_Info (const CSG_Matrix &X, double R2_prev, int iVariable, bool bIn) |
Protected Attributes | |
bool | m_bIntercept |
int * | m_bIncluded |
int * | m_Predictor |
int | m_nPredictors |
CSG_Strings | m_Names |
CSG_Matrix | m_Samples |
CSG_Matrix | m_Samples_Model |
class CSG_Table * | m_pRegression |
class CSG_Table * | m_pModel |
class CSG_Table * | m_pSteps |
Definition at line 1692 of file mat_tools.h.
CSG_Regression_Multiple::CSG_Regression_Multiple | ( | bool | bIntercept = true | ) |
Definition at line 114 of file mat_regression_multiple.cpp.
References CSG_Table::Add_Field(), CSG_Table::Add_Record(), m_bIntercept, m_nPredictors, m_pModel, m_Predictor, m_pRegression, m_pSteps, CSG_Table_Record::Set_Value(), SG_DATATYPE_Double, SG_DATATYPE_Int, SG_DATATYPE_String, and SG_T.
|
virtual |
Definition at line 181 of file mat_regression_multiple.cpp.
References Destroy(), m_pModel, m_pRegression, and m_pSteps.
|
inlineprotected |
Definition at line 563 of file mat_regression_multiple.cpp.
Referenced by _Get_P(), and _Set_Step_Info().
|
inlineprotected |
Definition at line 569 of file mat_regression_multiple.cpp.
References _Get_F(), CSG_Test_Distribution::Get_F_Tail(), and TESTDIST_TYPE_Right.
Referenced by _Get_Step_In(), _Get_Step_Out(), and _Set_Step_Info().
|
protected |
Definition at line 582 of file mat_regression_multiple.cpp.
References CSG_Table::Add_Record(), B, C, CSG_Matrix::Create(), CSG_Vector::Create(), CSG_Test_Distribution::Get_F_Tail_from_R2(), CSG_Matrix::Get_Inverse(), CSG_Matrix::Get_NX(), CSG_Matrix::Get_NY(), CSG_Table::Get_Record(), CSG_Test_Distribution::Get_T_Tail(), CSG_Matrix::Get_Transpose(), m_bIntercept, m_Names, m_pModel, m_pRegression, MLR_MODEL_F, MLR_MODEL_MSE, MLR_MODEL_MSR, MLR_MODEL_NPREDICT, MLR_MODEL_NSAMPLES, MLR_MODEL_R2, MLR_MODEL_R2_ADJ, MLR_MODEL_SE, MLR_MODEL_SIG, MLR_MODEL_SSE, MLR_MODEL_SSR, MLR_MODEL_SST, MLR_VAR_ID, MLR_VAR_NAME, MLR_VAR_R, MLR_VAR_R2, MLR_VAR_R2_ADJ, MLR_VAR_RCOEFF, MLR_VAR_SE, MLR_VAR_SIG, MLR_VAR_T, CSG_Table_Record::Set_Value(), SG_Get_Correlation_Matrix(), SG_Get_Square(), SG_Regression_Get_Adjusted_R2(), and TESTDIST_TYPE_TwoTail.
Referenced by Get_Model().
|
protected |
Definition at line 701 of file mat_regression_multiple.cpp.
References _Get_P(), _Set_Step_Info(), CSG_Matrix::Add_Cols(), CSG_Matrix::Del_Col(), CSG_Matrix::Get_Col(), Get_Model(), CSG_Matrix::Get_NX(), CSG_Matrix::Get_NY(), Get_R2(), m_bIncluded, m_bIntercept, m_nPredictors, m_Predictor, and CSG_Matrix::Set_Col().
Referenced by Get_Model_Forward(), and Get_Model_Stepwise().
|
protected |
Definition at line 745 of file mat_regression_multiple.cpp.
References _Get_P(), _Set_Step_Info(), CSG_Matrix::Del_Col(), Get_Model(), CSG_Matrix::Get_NY(), Get_R2(), m_bIncluded, m_bIntercept, m_nPredictors, and m_Predictor.
Referenced by Get_Model_Backward(), and Get_Model_Stepwise().
|
protected |
Definition at line 255 of file mat_regression_multiple.cpp.
References CSG_Matrix::Create(), CSG_Matrix::Get_Col(), CSG_Table::Get_Count(), CSG_Matrix::Get_NX(), CSG_Matrix::Get_NY(), CSG_Table::Get_Record(), m_bIncluded, m_nPredictors, m_pModel, m_Predictor, m_Samples, m_Samples_Model, CSG_Matrix::Set_Col(), and CSG_Table_Record::Set_NoData().
Referenced by Get_Model(), Get_Model_Backward(), Get_Model_Forward(), and Get_Model_Stepwise().
|
protected |
Definition at line 802 of file mat_regression_multiple.cpp.
References CSG_Table::Assign(), Get_Model(), CSG_Table::Get_Record(), m_bIntercept, m_Names, m_nPredictors, m_pModel, m_Predictor, m_pRegression, MLR_VAR_ID, MLR_VAR_NAME, and CSG_Table_Record::Set_Value().
Referenced by _Get_Step_In(), _Get_Step_Out(), Get_Model_Backward(), Get_Model_Forward(), and Get_Model_Stepwise().
|
protected |
Definition at line 828 of file mat_regression_multiple.cpp.
References _Get_F(), _Get_P(), CSG_Table::Add_Record(), CSG_Table_Record::asDouble(), CSG_Table::Get_Count(), Get_Model(), CSG_Matrix::Get_NRows(), CSG_Matrix::Get_NY(), Get_R2(), Get_R2_Adj(), CSG_Table::Get_Record(), Get_StdError(), m_bIntercept, m_Names, m_nPredictors, m_pModel, m_pSteps, MLR_MODEL_F, MLR_MODEL_MSE, MLR_MODEL_MSR, MLR_MODEL_SIG, MLR_MODEL_SSE, MLR_MODEL_SSR, MLR_STEP_DF, MLR_STEP_DIR, MLR_STEP_F, MLR_STEP_MSE, MLR_STEP_MSR, MLR_STEP_NR, MLR_STEP_R, MLR_STEP_R2, MLR_STEP_R2_ADJ, MLR_STEP_SE, MLR_STEP_SIG, MLR_STEP_SSE, MLR_STEP_SSR, MLR_STEP_VAR, MLR_STEP_VAR_F, MLR_STEP_VAR_SIG, CSG_Table_Record::Set_Value(), and SG_T.
void CSG_Regression_Multiple::Destroy | ( | void | ) |
Definition at line 196 of file mat_regression_multiple.cpp.
References CSG_Strings::Clear(), CSG_Table::Del_Records(), CSG_Matrix::Destroy(), CSG_Table::Get_Count(), CSG_Table::Get_Record(), m_bIncluded, m_Names, m_nPredictors, m_pModel, m_Predictor, m_pRegression, m_pSteps, m_Samples, m_Samples_Model, and CSG_Table_Record::Set_NoData().
Referenced by Set_Data(), and ~CSG_Regression_Multiple().
bool CSG_Regression_Multiple::Get_CrossValidation | ( | int | nSubSamples = 0 | ) |
Definition at line 385 of file mat_regression_multiple.cpp.
References CSG_Matrix::Add_Row(), CSG_Matrix::Del_Row(), CSG_Simple_Statistics::Get_Mean(), Get_Model(), CSG_Matrix::Get_NCols(), CSG_Matrix::Get_NRows(), CSG_Simple_Statistics::Get_Range(), CSG_Table::Get_Record(), CSG_Simple_Statistics::Get_Sum(), Get_Value(), m_bIntercept, m_nPredictors, m_pModel, m_Samples_Model, MLR_MODEL_CV_MSE, MLR_MODEL_CV_NRMSE, MLR_MODEL_CV_NSAMPLES, MLR_MODEL_CV_R2, MLR_MODEL_CV_RMSE, CSG_Table_Record::Set_Value(), SG_Get_Square(), and SG_UI_Process_Get_Okay().
double CSG_Regression_Multiple::Get_CV_NRMSE | ( | void | ) | const |
Definition at line 870 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_CV_NRMSE.
int CSG_Regression_Multiple::Get_CV_nSamples | ( | void | ) | const |
Definition at line 872 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asInt(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_CV_NSAMPLES.
double CSG_Regression_Multiple::Get_CV_R2 | ( | void | ) | const |
Definition at line 871 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_CV_R2.
double CSG_Regression_Multiple::Get_CV_RMSE | ( | void | ) | const |
Definition at line 869 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_CV_RMSE.
int CSG_Regression_Multiple::Get_DegFreedom | ( | void | ) | const |
Definition at line 875 of file mat_regression_multiple.cpp.
References Get_nPredictors(), and Get_nSamples().
Referenced by Get_Info().
double CSG_Regression_Multiple::Get_F | ( | void | ) | const |
Definition at line 867 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_F.
Referenced by Get_Info().
|
inline |
Definition at line 1738 of file mat_tools.h.
References MLR_VAR_ID.
CSG_String CSG_Regression_Multiple::Get_Info | ( | void | ) | const |
Definition at line 916 of file mat_regression_multiple.cpp.
References _TL, CSG_Table_Record::asDouble(), CSG_Table_Record::asInt(), CSG_Table_Record::asString(), CSG_String::Format(), CSG_Table::Get_Count(), Get_DegFreedom(), Get_F(), Get_nPredictors(), Get_P(), Get_R2(), Get_R2_Adj(), Get_RCoeff(), Get_RConst(), CSG_Table::Get_Record(), Get_StdError(), m_pRegression, m_pSteps, MLR_STEP_DIR, MLR_STEP_F, MLR_STEP_NR, MLR_STEP_R, MLR_STEP_R2, MLR_STEP_R2_ADJ, MLR_STEP_SE, MLR_STEP_SIG, MLR_STEP_VAR, MLR_STEP_VAR_F, MLR_STEP_VAR_SIG, MLR_VAR_NAME, MLR_VAR_R, MLR_VAR_R2, MLR_VAR_R2_ADJ, MLR_VAR_RCOEFF, MLR_VAR_SE, MLR_VAR_SIG, and MLR_VAR_T.
|
inline |
Definition at line 1719 of file mat_tools.h.
|
inline |
Definition at line 1718 of file mat_tools.h.
|
inline |
Definition at line 1720 of file mat_tools.h.
bool CSG_Regression_Multiple::Get_Model | ( | const CSG_Matrix & | Samples, |
CSG_Strings * | pNames = NULL |
||
) |
Definition at line 297 of file mat_regression_multiple.cpp.
References Get_Model(), and Set_Data().
Referenced by _Get_Step_In(), _Get_Step_Out(), _Set_Step_Info(), and Get_CrossValidation().
bool CSG_Regression_Multiple::Get_Model | ( | void | ) |
Definition at line 318 of file mat_regression_multiple.cpp.
References _Get_Regression(), _Initialize(), and m_Samples.
Referenced by Get_Model().
bool CSG_Regression_Multiple::Get_Model_Backward | ( | const CSG_Matrix & | Samples, |
double | P_out, | ||
CSG_Strings * | pNames = NULL |
||
) |
Definition at line 307 of file mat_regression_multiple.cpp.
References Set_Data().
bool CSG_Regression_Multiple::Get_Model_Backward | ( | double | P_out | ) |
Definition at line 339 of file mat_regression_multiple.cpp.
References _Get_Step_Out(), _Initialize(), _Set_Step_Info(), and m_Samples_Model.
bool CSG_Regression_Multiple::Get_Model_Forward | ( | const CSG_Matrix & | Samples, |
double | P_in, | ||
CSG_Strings * | pNames = NULL |
||
) |
Definition at line 302 of file mat_regression_multiple.cpp.
References Set_Data().
bool CSG_Regression_Multiple::Get_Model_Forward | ( | double | P_in | ) |
Definition at line 324 of file mat_regression_multiple.cpp.
References _Get_Step_In(), _Initialize(), _Set_Step_Info(), m_Samples, and m_Samples_Model.
bool CSG_Regression_Multiple::Get_Model_Stepwise | ( | const CSG_Matrix & | Samples, |
double | P_in, | ||
double | P_out, | ||
CSG_Strings * | pNames = NULL |
||
) |
Definition at line 312 of file mat_regression_multiple.cpp.
References Set_Data().
bool CSG_Regression_Multiple::Get_Model_Stepwise | ( | double | P_in, |
double | P_out | ||
) |
Definition at line 354 of file mat_regression_multiple.cpp.
References _Get_Step_In(), _Get_Step_Out(), _Initialize(), _Set_Step_Info(), m_nPredictors, m_Samples, m_Samples_Model, and SG_UI_Process_Get_Okay().
const SG_Char * CSG_Regression_Multiple::Get_Name | ( | int | iVariable | ) | const |
Definition at line 878 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asString(), CSG_Table::Get_Record(), m_pRegression, MLR_VAR_NAME, and SG_T.
int CSG_Regression_Multiple::Get_nPredictors | ( | void | ) | const |
Definition at line 873 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asInt(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_NPREDICT.
Referenced by Get_DegFreedom(), and Get_Info().
int CSG_Regression_Multiple::Get_nSamples | ( | void | ) | const |
Definition at line 874 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asInt(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_NSAMPLES.
Referenced by Get_DegFreedom().
|
inline |
Definition at line 1744 of file mat_tools.h.
References MLR_VAR_SIG.
double CSG_Regression_Multiple::Get_P | ( | void | ) | const |
Definition at line 868 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_SIG.
Referenced by Get_Info().
double CSG_Regression_Multiple::Get_Parameter | ( | int | iVariable, |
int | Parameter | ||
) | const |
Definition at line 900 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pRegression, and MLR_VAR_P.
|
inline |
Definition at line 1734 of file mat_tools.h.
double CSG_Regression_Multiple::Get_R2 | ( | void | ) | const |
Definition at line 864 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_R2.
Referenced by _Get_Step_In(), _Get_Step_Out(), _Set_Step_Info(), and Get_Info().
double CSG_Regression_Multiple::Get_R2_Adj | ( | void | ) | const |
Definition at line 865 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_R2_ADJ.
Referenced by _Set_Step_Info(), and Get_Info().
|
inline |
Definition at line 1740 of file mat_tools.h.
References MLR_VAR_R2.
|
inline |
Definition at line 1741 of file mat_tools.h.
References MLR_VAR_R2_ADJ.
|
inline |
Definition at line 1739 of file mat_tools.h.
References MLR_VAR_RCOEFF.
Referenced by Get_Info(), Get_Residual(), and Get_Value().
double CSG_Regression_Multiple::Get_RConst | ( | void | ) | const |
Definition at line 889 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Count(), CSG_Table::Get_Record(), m_pRegression, and MLR_VAR_RCOEFF.
Referenced by Get_Info(), Get_Residual(), and Get_Value().
double CSG_Regression_Multiple::Get_Residual | ( | int | iSample | ) | const |
Definition at line 518 of file mat_regression_multiple.cpp.
Referenced by Get_Residuals().
bool CSG_Regression_Multiple::Get_Residual | ( | int | iSample, |
double & | Residual | ||
) | const |
Definition at line 523 of file mat_regression_multiple.cpp.
References CSG_Matrix::Get_NRows(), Get_RCoeff(), Get_RConst(), m_nPredictors, and m_Samples_Model.
bool CSG_Regression_Multiple::Get_Residuals | ( | CSG_Vector & | Residuals | ) | const |
Definition at line 545 of file mat_regression_multiple.cpp.
References CSG_Vector::Create(), CSG_Vector::Get_N(), CSG_Matrix::Get_NRows(), Get_Residual(), and m_Samples_Model.
|
inline |
Definition at line 1742 of file mat_tools.h.
References MLR_VAR_SE.
double CSG_Regression_Multiple::Get_StdError | ( | void | ) | const |
Definition at line 866 of file mat_regression_multiple.cpp.
References CSG_Table_Record::asDouble(), CSG_Table::Get_Record(), m_pModel, and MLR_MODEL_SE.
Referenced by _Set_Step_Info(), and Get_Info().
|
inline |
Definition at line 1743 of file mat_tools.h.
References MLR_VAR_T.
double CSG_Regression_Multiple::Get_Value | ( | const CSG_Vector & | Predictors | ) | const |
Definition at line 493 of file mat_regression_multiple.cpp.
Referenced by Get_CrossValidation().
bool CSG_Regression_Multiple::Get_Value | ( | const CSG_Vector & | Predictors, |
double & | Value | ||
) | const |
Definition at line 498 of file mat_regression_multiple.cpp.
References CSG_Vector::Get_N(), Get_RCoeff(), Get_RConst(), and m_nPredictors.
|
inline |
Definition at line 1703 of file mat_tools.h.
bool CSG_Regression_Multiple::Set_Data | ( | const CSG_Matrix & | Samples, |
CSG_Strings * | pNames = NULL |
||
) |
Definition at line 226 of file mat_regression_multiple.cpp.
References _TL, Destroy(), CSG_String::Format(), CSG_Strings::Get_Count(), CSG_Matrix::Get_NCols(), CSG_Matrix::Get_NX(), CSG_Matrix::Get_NY(), CSG_Strings::Get_String(), m_bIncluded, m_Names, m_Predictor, and m_Samples.
Referenced by Get_Model(), Get_Model_Backward(), Get_Model_Forward(), and Get_Model_Stepwise().
|
inline |
Definition at line 1702 of file mat_tools.h.
|
protected |
Definition at line 1761 of file mat_tools.h.
Referenced by _Get_Step_In(), _Get_Step_Out(), _Initialize(), Destroy(), and Set_Data().
|
protected |
Definition at line 1759 of file mat_tools.h.
Referenced by _Get_Regression(), _Get_Step_In(), _Get_Step_Out(), _Set_Step_Info(), CSG_Regression_Multiple(), and Get_CrossValidation().
|
protected |
Definition at line 1763 of file mat_tools.h.
Referenced by _Get_Regression(), _Set_Step_Info(), Destroy(), and Set_Data().
|
protected |
Definition at line 1761 of file mat_tools.h.
Referenced by _Get_Step_In(), _Get_Step_Out(), _Initialize(), _Set_Step_Info(), CSG_Regression_Multiple(), Destroy(), Get_CrossValidation(), Get_Model_Stepwise(), Get_Residual(), and Get_Value().
|
protected |
Definition at line 1767 of file mat_tools.h.
Referenced by _Get_Regression(), _Initialize(), _Set_Step_Info(), CSG_Regression_Multiple(), Destroy(), Get_CrossValidation(), Get_CV_NRMSE(), Get_CV_nSamples(), Get_CV_R2(), Get_CV_RMSE(), Get_F(), Get_nPredictors(), Get_nSamples(), Get_P(), Get_R2(), Get_R2_Adj(), Get_StdError(), and ~CSG_Regression_Multiple().
|
protected |
Definition at line 1761 of file mat_tools.h.
Referenced by _Get_Step_In(), _Get_Step_Out(), _Initialize(), _Set_Step_Info(), CSG_Regression_Multiple(), Destroy(), and Set_Data().
|
protected |
Definition at line 1767 of file mat_tools.h.
Referenced by _Get_Regression(), _Set_Step_Info(), CSG_Regression_Multiple(), Destroy(), Get_Info(), Get_Name(), Get_Parameter(), Get_RConst(), and ~CSG_Regression_Multiple().
|
protected |
Definition at line 1767 of file mat_tools.h.
Referenced by _Set_Step_Info(), CSG_Regression_Multiple(), Destroy(), Get_Info(), and ~CSG_Regression_Multiple().
|
protected |
Definition at line 1765 of file mat_tools.h.
Referenced by _Initialize(), Destroy(), Get_Model(), Get_Model_Forward(), Get_Model_Stepwise(), and Set_Data().
|
protected |
Definition at line 1765 of file mat_tools.h.
Referenced by _Initialize(), Destroy(), Get_CrossValidation(), Get_Model_Backward(), Get_Model_Forward(), Get_Model_Stepwise(), Get_Residual(), and Get_Residuals().