mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 08:55:37 +00:00
normalised residuals routines
This commit is contained in:
parent
24a7b9c203
commit
adf2c9cc69
@ -346,6 +346,29 @@ XYSampleData XYSampleData::getResiduals(const SampleFitResult &fit)
|
||||
return res;
|
||||
}
|
||||
|
||||
XYSampleData XYSampleData::getNormalisedResiduals(const SampleFitResult &fit)
|
||||
{
|
||||
XYSampleData res(*this);
|
||||
|
||||
for (Index j = 0; j < getNYDim(); ++j)
|
||||
{
|
||||
const DoubleFunctionSample &f = fit.getModel(_, j);
|
||||
|
||||
for (auto &p: yData_[j])
|
||||
{
|
||||
res.y(p.first, j) -= f(x(p.first));
|
||||
}
|
||||
|
||||
const DMat &var = res.getYYVar(j, j);
|
||||
for (auto &p: yData_[j])
|
||||
{
|
||||
res.y(p.first, j) /= sqrt(var(p.first, p.first));
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
XYSampleData XYSampleData::getPartialResiduals(const SampleFitResult &fit,
|
||||
const DVec &ref, const Index i)
|
||||
{
|
||||
|
@ -111,6 +111,7 @@ public:
|
||||
const DoubleModel &model, const Ts... models);
|
||||
// residuals
|
||||
XYSampleData getResiduals(const SampleFitResult &fit);
|
||||
XYSampleData getNormalisedResiduals(const SampleFitResult &fit);
|
||||
XYSampleData getPartialResiduals(const SampleFitResult &fit, const DVec &x,
|
||||
const Index i);
|
||||
private:
|
||||
|
@ -379,6 +379,24 @@ XYStatData XYStatData::getResiduals(const FitResult &fit)
|
||||
return res;
|
||||
}
|
||||
|
||||
XYStatData XYStatData::getNormalisedResiduals(const FitResult &fit)
|
||||
{
|
||||
XYStatData res(*this);
|
||||
|
||||
for (Index j = 0; j < getNYDim(); ++j)
|
||||
{
|
||||
const DoubleFunction &f = fit.getModel(j);
|
||||
|
||||
for (auto &p: yData_[j])
|
||||
{
|
||||
res.y(p.first, j) -= f(x(p.first));
|
||||
res.y(p.first, j) /= sqrt(getYYVar(j, j)(p.first, p.first));
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
XYStatData XYStatData::getPartialResiduals(const FitResult &fit,
|
||||
const DVec &ref, const Index i)
|
||||
{
|
||||
|
@ -104,6 +104,7 @@ public:
|
||||
const DoubleModel &model, const Ts... models);
|
||||
// residuals
|
||||
XYStatData getResiduals(const FitResult &fit);
|
||||
XYStatData getNormalisedResiduals(const FitResult &fit);
|
||||
XYStatData getPartialResiduals(const FitResult &fit, const DVec &ref,
|
||||
const Index i);
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user