mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2025-04-11 03:20:46 +01: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;
|
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,
|
XYSampleData XYSampleData::getPartialResiduals(const SampleFitResult &fit,
|
||||||
const DVec &ref, const Index i)
|
const DVec &ref, const Index i)
|
||||||
{
|
{
|
||||||
|
@ -111,6 +111,7 @@ public:
|
|||||||
const DoubleModel &model, const Ts... models);
|
const DoubleModel &model, const Ts... models);
|
||||||
// residuals
|
// residuals
|
||||||
XYSampleData getResiduals(const SampleFitResult &fit);
|
XYSampleData getResiduals(const SampleFitResult &fit);
|
||||||
|
XYSampleData getNormalisedResiduals(const SampleFitResult &fit);
|
||||||
XYSampleData getPartialResiduals(const SampleFitResult &fit, const DVec &x,
|
XYSampleData getPartialResiduals(const SampleFitResult &fit, const DVec &x,
|
||||||
const Index i);
|
const Index i);
|
||||||
private:
|
private:
|
||||||
|
@ -379,6 +379,24 @@ XYStatData XYStatData::getResiduals(const FitResult &fit)
|
|||||||
return res;
|
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,
|
XYStatData XYStatData::getPartialResiduals(const FitResult &fit,
|
||||||
const DVec &ref, const Index i)
|
const DVec &ref, const Index i)
|
||||||
{
|
{
|
||||||
|
@ -104,6 +104,7 @@ public:
|
|||||||
const DoubleModel &model, const Ts... models);
|
const DoubleModel &model, const Ts... models);
|
||||||
// residuals
|
// residuals
|
||||||
XYStatData getResiduals(const FitResult &fit);
|
XYStatData getResiduals(const FitResult &fit);
|
||||||
|
XYStatData getNormalisedResiduals(const FitResult &fit);
|
||||||
XYStatData getPartialResiduals(const FitResult &fit, const DVec &ref,
|
XYStatData getPartialResiduals(const FitResult &fit, const DVec &ref,
|
||||||
const Index i);
|
const Index i);
|
||||||
protected:
|
protected:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user