Regress.RegressTest Method

Overload List

#SignatureDescription
1void RegressTest(TVec Y, TVec YCalc, TMtx ATA, ref TRegStats RegStat, TVec Residuals, TVec BStdDev, Boolean Constant, TVec Weights)Regression tests.
2void RegressTest(TVec Y, TVec YCalc, Int32 NumPars, ref TRegStats RegStat, Boolean Constant, TVec Weights)Regression tests.

Overload 1: void RegressTest(TVec Y, TVec YCalc, TMtx ATA, ref TRegStats RegStat, TVec Residuals, TVec BStdDev, Boolean Constant, TVec Weights)

Regression tests.

#NameDescription
1YDependant variables.
2YCalcEstimated (calculated) dependant variables.
3ATAInverse matrix of normal equations i.e [A(T)*A]^-1.
4WeightsModel weights (optional).
5ConstantIf true then include intercept term b(0) in calculations. If false, set intercept term b(0) to 0.0.
6RegStatReturns regression statistics parameters.
7ResidualsReturns residual errors.
8BStdDevReturns standard deviation.

Result: stored in self (calling object)

Remarks:

Using regression results the routine calculates additional regression statistical parameters, together with model coefficients standard errors and model errors.

Examples
using Dew.Math;
using Dew.Stats.Units;
using Dew.Stats;
namespace Dew.Examples
{
    private void Example()
    {
        Matrix A = new Matrix(0, 0);
        Matrix ATA = new Matrix(0, 0);
        Vector y = new Vector(0);
        Vector b = new Vector(0);
        Vector w = new Vector(0);
        Vector yhat = new Vector(0);
        Vector res = new Vector(0);
        Vector bse = new Vector(0);
        TRegStats rs;

        // independent variables
        A.SetIt(4, 2, false, new double[] {1.0, 2.0,
            -3.2, 2.5,
                8.0, -0.5,
                -2.2, 1.8});

        w.SetIt(false, new double[] { 1, 2, 2, 1 }); // weights
        y.SetIt(false, new double[] { -3.0, 0.25, 8.0, 5.5 }); // dependent variables
        Regress.MulLinRegress(y, A, b, w, true, yhat, ATA, TRegSolveMethod.regSolveLQR); //do regression
            // b=(19.093757944, -2.0141843616, -10.082487055)
        Regress.RegressTest(y, yhat, ATA, out rs, res, bse, true, w); // do basic regression stats
            // RegStat = (ResidualVar:0.037230395108; R2:0.99965713428;
            // AdjustedR2:0.99897140285; F:1457.7968725; SignifProb: 0.01851663347)
    }
}
See Also: Regress.R2, Regress.PRESS

Overload 2: void RegressTest(TVec Y, TVec YCalc, Int32 NumPars, ref TRegStats RegStat, Boolean Constant, TVec Weights)

Regression tests.

#NameDescription
1YDependant variables.
2YCalcEstimated (calculated) dependant variables.
3WeightsModel weights (optional).
4NumParsNumber of variables (parameters) in ML model A*b=y (number of columns in A matrix or number of rows in b).
5ConstantIf true then include intercept term b(0) in calculations. If false, set intercept term b(0) to 0.0.
6RegStatReturns regression statistics parameters.

Result: stored in self (calling object)

Remarks:

Use regression results to calculate basic regression statistics for model:

A*b=Y

See Also: Regress.R2, Regress.PRESS