void LinRegress(TVec *X, TVec *Y, TVec *B, bool Constant = true, TVec *Weights = null, TVec *YCalc = null, TMtx *ATA = null);
Simple linear regression.
| # | Name | Type | Description |
|---|---|---|---|
| 1 | X | TVec * | |
| 2 | Y | TVec * | |
| 3 | B | TVec * | |
| 4 | Constant = true | bool | |
| 5 | Weights = null | TVec * | |
| 6 | YCalc = null | TVec * | |
| 7 | ATA = null | TMtx * |
Remarks:
The routine fits equations to data by minimizing the sum of squared residuals:
SS = Sum [y(k) - ycalc(k)]^2 ,
where y(k) and ycalc(k) are respectively the observed and calculated value of the dependent variable for observation k. ycalc(k) is a function of the regression parameters b(0) and b(1). In case constant term is used, the observed values obey the following equation:
y(k) = b(0) + b(1) * x
i.e
Y = b(0) + b(1)*X.
or if constant term is NOT used:
y(k) = b(0) * x
To calculate additional regression statistical parameters, use Regress::RegressTest routine.
See Also: Regress::MulLinRegress, Regress::RegressTest
Declared in Dew::Stats::Units::Regress · Dew.Stats/Units.Regress.h · Cross-compiler