From 3a70dfe1f19f0a6f15bb408ff8f2470fd9975ca1 Mon Sep 17 00:00:00 2001 From: wp Date: Wed, 22 Aug 2018 08:02:19 +0000 Subject: [PATCH] TAChart: Fix x values for TFitSeries' confidence/prediction intervals in case of FitEquation = fePower git-svn-id: trunk@58755 - --- components/tachart/tafuncseries.pas | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/components/tachart/tafuncseries.pas b/components/tachart/tafuncseries.pas index 793245775c..abf413a085 100644 --- a/components/tachart/tafuncseries.pas +++ b/components/tachart/tafuncseries.pas @@ -1738,7 +1738,6 @@ begin sig := GetParam_RawError(AIndex); alpha := 1.0 - FConfidenceLevel; t := FitStatistics.tValue; -// t := invtdist(alpha, FitStatistics.DOF, 2); ALower := val - sig*t; AUpper := val + sig*t; if (FFitEquation in [feExp, fePower]) and (AIndex = 0) then begin @@ -1750,14 +1749,16 @@ end; procedure TFitSeries.GetInterval(const aX: Double; out AY: Double; IsUpper, IsPrediction: Boolean); var - y: Double; + x,y: Double; dy: Double; Offs: Double; begin offs := IfThen(IsPrediction, 1, 0); with FitStatistics do begin - y := TransformY(Calculate(AX)); - dy := tValue * ResidualStdError * sqrt(offs + 1/N + sqr(AX - xBar) / SSx); + x := TransformX(AX); + y := Calculate(AX); + y := TransformY(y); + dy := tValue * ResidualStdError * sqrt(offs + 1/N + sqr(x - xBar) / SSx); if IsUpper then AY := y + dy else