#include <Linls.hh>
Public Methods | |
Linls_ (size_t NM=0, size_t NP=0) | |
Init to empty. | |
double | lin_reg (const Rmatdbl_ &Xmeas, const Vecdbl_ &Ymeas, double Eps=1e-10) |
lin_reg(Xmeas, Ymeas, Eps): Carries out a linear least squares fit using SVD. More... | |
size_t | rank () const |
Returns the rank. | |
double | condition () const |
Returns the condition number. | |
size_t | deg_freedom () const |
Returns the degrees of freedom. | |
const Vecdbl_& | param () const |
Returns the parameter estimate. | |
const Vecdbl_& | sdev () const |
Returns the standard deviation of the parameters. | |
const Smatdbl_& | correl () const |
Returns the correlation matrix of the parameters. | |
double | chi_square () const |
Returns the chi-square statistic for the fit quality. | |
double | residual_dev () const |
Returns the residual deviation for the fit. | |
Protected Methods | |
void | adjust_dimensions (const Rmatdbl_ &Xmeas, const Vecdbl_ &Ymeas) |
void | make_utb (const Vecdbl_ &B) |
size_t | calc_rank (const Vecdbl_ &B, double Eps) const |
void | calc_params (const Rmatdbl_ &Xmeas, const Vecdbl_ &Ymeas) |
double | calc_chi2 (const Rmatdbl_ &Xmeas, const Vecdbl_ &Ymeas) const |
Private Attributes | |
size_t | Nm |
size_t | Np |
size_t | Nf |
no. of measurements, no.of params, degrees of freedom. | |
Svd_ | Svd |
an SVD object. | |
size_t | Rank |
the rank estimate. | |
Vecdbl_ | Utb |
scalprods of U cols w/ RHS. | |
Vecdbl_ | P |
Vecdbl_ | Sdev |
parameter values and standard deviations. | |
Smatdbl_ | Correl |
parameter correlation matrix. | |
double | Chi2 |
chi-square. |
Note that unlike Linreg_, this class is not derived from Paramest_.
Definition at line 35 of file Linls.hh.
|
Init to empty.
|
|
lin_reg(Xmeas, Ymeas, Eps): Carries out a linear least squares fit using SVD. Xmeas is the data matrix (Nm rows of observations for Np indep. vars, Nm>Np), Ymeas is the Nm observations of the dependent variable. Eps is a small tolerance value used for finding the best SVD rank. Should be a "small multiple of the machine zero". If in doubt, set it to 0.0 and it will be figured out for you. Return value: the chi-square statistics of the fit, or a negative value on error. |
|
Returns the rank.
Definition at line 70 of file Linls.hh. Referenced by condition(). |
|
Returns the condition number.
|
|
Returns the degrees of freedom.
|
|
Returns the parameter estimate.
|
|
Returns the standard deviation of the parameters.
|
|
Returns the correlation matrix of the parameters.
|
|
Returns the chi-square statistic for the fit quality.
|
|
Returns the residual deviation for the fit.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
no. of measurements, no.of params, degrees of freedom.
|
|
an SVD object.
|
|
the rank estimate.
|
|
scalprods of U cols w/ RHS.
|
|
|
|
parameter values and standard deviations.
|
|
parameter correlation matrix.
|
|
chi-square.
|