157 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"STD_ERROR" ));
165 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"PREDICTORS" ));
166 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"SAMPLES" ));
168 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"CV_RMSE" ));
169 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"CV_NRMSE" ));
171 m_pModel ->Add_Record()->Set_Value(0,
SG_T(
"CV_SAMPLES" ));
205 for(
int i=0; i<
m_pModel->Get_Count(); i++)
207 m_pModel->Get_Record(i)->Set_NoData(1);
230 int nPredictors = Samples.
Get_NX() - 1;
232 if( nPredictors < 1 || Samples.
Get_NY() <= nPredictors )
238 for(
int i=0; i<=nPredictors; i++)
257 int nPredictors =
m_Samples.Get_NX() - 1;
259 if( nPredictors < 1 ||
m_Samples.Get_NY() <= nPredictors )
276 for(
int i=0; i<nPredictors; i++)
282 for(
int i=0; i<
m_pModel->Get_Count(); i++)
284 m_pModel->Get_Record(i)->Set_NoData(1);
362 P_out = P_in + 0.001;
405 if( nSubSamples <= 1 || nSubSamples >
m_Samples_Model.Get_NRows() / 2 )
433 SubSet[i] = i % nSubSamples;
442 for(i=Samples.Get_NY()-1; i>=0; i--)
444 if( SubSet[i] == iSubSet )
446 Validation.
Add_Row(Samples.Get_Row(i));
451 Samples_Stats += Samples[i][0];
462 double dObsrv = Validation[i][0];
495 double Value;
Get_Value(Predictors, Value);
return( Value );
520 double Value;
Get_Residual(iSample, Value);
return( Value );
549 for(
int i=0; i<Residuals.
Get_N(); i++)
554 return( Residuals.
Get_N() > 0 );
565 return( (nSamples - nPredictors - 1) * (r2_full - r2_reduced) / (1. - r2_full) );
571 double f =
_Get_F(nPredictors, nSamples, r2_full, r2_reduced);
584 int nPredictors = Samples.
Get_NX() - 1;
585 int nSamples = Samples.
Get_NY();
589 double Ym, SSR, SSE, SST, MSR, MSE, SE, R2, F;
597 for(i=0, Ym=0.; i<nSamples; i++)
599 Ym += Y[i] = Samples[i][0];
605 for(j=1; j<=nPredictors; j++)
607 X[i][j] = Samples[i][j];
612 for(j=0; j<nPredictors; j++)
614 X[i][j] = Samples[i][j + 1];
624 C = (Xt * X).Get_Inverse();
631 for(i=0, SSE=0., SSR=0., SST=0.; i<nSamples; i++)
640 MSR = SSR / nPredictors;
641 MSE = SSE / (nSamples - nPredictors - 1);
642 SE = sqrt(SSE / (nSamples - nPredictors));
668 for(j=0; j<
B.Get_N(); j++)
670 double se = SE * sqrt(fabs(
C[j][j]));
674 double r = -P[k][0] / sqrt(P[k][k] * P[0][0]);
703 int iBest, iPredictor;
double rBest;
710 for(iPredictor=0, iBest=-1, rBest=0.; iPredictor<Samples.
Get_NX()-1; iPredictor++)
747 int iBest, iPredictor;
double rBest;
759 for(iPredictor=0, iBest=-1, rBest=0.; iPredictor<
m_nPredictors; iPredictor++)
763 X_reduced.
Del_Col(1 + iPredictor);
783 for(iPredictor=iBest; iPredictor<
m_nPredictors; iPredictor++)
880 if( iVariable >= 0 && iVariable < m_pRegression->Get_Count() - 1 )
902 if( iVariable >= 0 && iVariable < m_pRegression->Get_Count() - 1 && Parameter >= 0 && Parameter <=
MLR_VAR_P )
904 return(
m_pRegression->Get_Record(1 + iVariable)->asDouble(Parameter) );
929 s +=
CSG_String::Format(
"No. \tR \tR2 \tR2 adj\tStdErr\tF \tP \tF step\tP step\tVariable\n");
930 s +=
CSG_String::Format(
"------\t------\t------\t------\t------\t------\t------\t------\t------\t------\n");
932 for(
int i=0; i<
m_pSteps->Get_Count(); i++)
936 s +=
CSG_String::Format(
"%d.\t%.2f\t%.2f\t%.2f\t%.3f\t%.3f\t%.3f\t%.3f\t%.3f\t%s %s\n",
954 s +=
CSG_String::Format(
"No. \tR \tR2 \tR2 adj\tStdErr\tt \tSig. \tb \t\tVariable\n");
955 s +=
CSG_String::Format(
"------\t------\t------\t------\t------\t------\t---------\t---------\t\t---------\n");
bool SG_UI_Process_Get_Okay(bool bBlink)
sLong Get_NRows(void) const
CSG_Matrix Get_Transpose(void) const
bool Add_Row(const double *Data=NULL)
sLong Get_NCols(void) const
bool Create(const CSG_Matrix &Matrix)
CSG_Vector Get_Col(sLong Col) const
bool Set_Col(sLong Col, const double *Data)
bool Add_Cols(sLong nCols)
CSG_Matrix Get_Inverse(bool bSilent=true, int nSubSquare=0) const
CSG_Regression_Multiple(bool bIntercept=true)
class CSG_Table * m_pModel
double _Get_P(int nPredictors, int nSamples, double r2_full, double r2_reduced)
double Get_Parameter(int iVariable, int Parameter) const
CSG_String Get_Info(void) const
double Get_CV_R2(void) const
int Get_CV_nSamples(void) const
bool Get_Model(const CSG_Matrix &Samples, CSG_Strings *pNames=NULL)
CSG_Matrix m_Samples_Model
bool Get_Residuals(CSG_Vector &Residuals) const
bool _Set_Step_Info(const CSG_Matrix &X)
double Get_CV_NRMSE(void) const
int Get_nPredictors(void) const
int _Get_Step_Out(CSG_Matrix &X, double P_out, double &R2)
double Get_R2(void) const
double Get_RCoeff(int iVariable) const
bool Set_Data(const CSG_Matrix &Samples, CSG_Strings *pNames=NULL)
bool Get_Model_Forward(const CSG_Matrix &Samples, double P_in, CSG_Strings *pNames=NULL)
bool _Initialize(bool bInclude)
int Get_DegFreedom(void) const
int _Get_Step_In(CSG_Matrix &X, double P_in, double &R2, const CSG_Matrix &Samples)
int Get_nSamples(void) const
double Get_R2_Adj(void) const
double Get_CV_RMSE(void) const
bool Get_CrossValidation(int nSubSamples=0)
bool Get_Model_Stepwise(const CSG_Matrix &Samples, double P_in, double P_out, CSG_Strings *pNames=NULL)
double Get_Value(const CSG_Vector &Predictors) const
double Get_StdError(void) const
virtual ~CSG_Regression_Multiple(void)
bool _Get_Regression(const class CSG_Matrix &Samples)
bool Get_Model_Backward(const CSG_Matrix &Samples, double P_out, CSG_Strings *pNames=NULL)
double Get_Residual(int iSample) const
class CSG_Table * m_pSteps
double Get_RConst(void) const
double _Get_F(int nPredictors, int nSamples, double r2_full, double r2_reduced)
const SG_Char * Get_Name(int iVariable) const
class CSG_Table * m_pRegression
static CSG_String Format(const char *Format,...)
CSG_String & Get_String(int Index) const
int Get_Count(void) const
bool Set_Value(int Field, const CSG_String &Value)
double asDouble(int Field) const
int asInt(int Field) const
const SG_Char * asString(int Field, int Decimals=-99) const
virtual CSG_Table_Record * Get_Record(sLong Index) const
static double Get_F_Tail_from_R2(double R2, int nPredictors, int nSamples, TSG_Test_Distribution_Type Type=TESTDIST_TYPE_Right)
static double Get_T_Tail(double T, int df, TSG_Test_Distribution_Type Type=TESTDIST_TYPE_Right)
static double Get_F_Tail(double F, int dfn, int dfd, TSG_Test_Distribution_Type Type=TESTDIST_TYPE_Right)
bool Create(const CSG_Vector &Vector)
ESG_Multiple_Regression_Info_Model
ESG_Multiple_Regression_Info_Steps