Getting R, P, and T values ​​for each coefficient in multiple regression (math.net)

I am using https://numerics.mathdotnet.com/Regression.html for reference. I tried to get the r value for each independent variable in my code below, but I don’t know if this is correct, and if this is the right way to do this, how to get also the p value and T.

Here is my current code:

var ema12 = calc.ListCalculationData.Select(i => (double)i.Ema12).ToArray();
var ema26 = calc.ListCalculationData.Select(i => (double)i.Ema26).ToArray();
var ema = calc.ListCalculationData.Select(i => (double)i.Ema).ToArray();
var targetvalue = calc.ListCalculationData.Select(i => (double)i.MRTargetValue).ToArray();
var matrixArray = CreateMatrix.DenseOfColumnArrays(ema12, ema26, ema);
var vectorArray = CreateVector.Dense(targetvalue);
var items = MultipleRegression.QR(matrixArray, vectorArray);
var r1 = GoodnessOfFit.RSquared(ema12, vectorArray);
var r2 = GoodnessOfFit.RSquared(ema26, vectorArray);
var r3 = GoodnessOfFit.RSquared(ema, vectorArray);
  • Is this the right way to get the R value for each independent variable?
  • How to get the value of P and T-statistics for each independent variable?
  • Also, to verify that multicollinearity is between two independent variables, is the correct code below?

    var multiCol = GoodnessOfFit.RSquared (ema12, ema26);

+4

Source: https://habr.com/ru/post/1685108/


All Articles