y=a0 z1 + a1 z1 +a2 z2 + a3 z3 +...
Namespace:
Hyleos.Mathematic.MatrixAssembly: Hyleos.Mathematic (in Hyleos.Mathematic.dll) Version: 1.0.1.1 (1.0.1.1)
Syntax
| C# |
|---|
public static double[] Regress( double[,] dZ, double[] dY ) |
| Visual Basic (Declaration) |
|---|
Public Shared Function Regress ( _ dZ As Double(,), _ dY As Double() _ ) As Double() |
| Visual C++ |
|---|
public: static array<double>^ Regress( array<double,2>^ dZ, array<double>^ dY ) |
Parameters
- dZ
- Type: array<
System..::.Double
,2>[,](,)[,]
functional values. index 0 is a row, the variables go across index 1
- dY
- Type: array<
System..::.Double
>[]()[]
summed value
Return Value
coefficients
Examples
// Y = A + BX // For this equation, z0 is 1 and z1 is X, and y is Y. double[] dX=new double[]{2.3601, 2.3942, 2.4098, 2.4268, 2.4443, 2.4552, 2.4689, 2.4885, 2.5093, 2.5287}; double[] dY = new double[] { 133.322, 666.612, 1333.22, 2666.45, 5332.9, 7999.35, 13332.2, 26664.5, 53329, 101325 }; int nPolyOrder = 1; double[,] dZ = new double[dY.Length, nPolyOrder+1]; for (int i = 0; i < dY.Length; i++) { dZ[i, 0] = 1.0; dZ[i, 1] = dX[i]; } double[] dCoefs = MatrixDouble.Regress(dZ, dY);
Examples
// Y = A + BX + CX2 // For this equation, z0 is 1, z1 is X, z2 is X2, and y is Y. double[] dX=new double[]{2.3601, 2.3942, 2.4098, 2.4268, 2.4443, 2.4552, 2.4689, 2.4885, 2.5093, 2.5287}; double[] dY = new double[] { 133.322, 666.612, 1333.22, 2666.45, 5332.9, 7999.35, 13332.2, 26664.5, 53329, 101325 }; int nPolyOrder = 2; double[,] dZ = new double[dY.Length, nPolyOrder+1]; for (int i = 0; i < dY.Length; i++) { dZ[i, 0] = 1.0; dZ[i, 1] = dX[i]; dZ[i, 2] = dX[i] * dX[i]; } double[] dCoefs = MatrixNumeric.Regress(dZ, dY);