TAChart: Fix x values for TFitSeries' confidence/prediction intervals in case of FitEquation = fePower

git-svn-id: trunk@58755 -
This commit is contained in:
wp 2018-08-22 08:02:19 +00:00
parent 20c1203380
commit 3a70dfe1f1

View File

@ -1738,7 +1738,6 @@ begin
sig := GetParam_RawError(AIndex); sig := GetParam_RawError(AIndex);
alpha := 1.0 - FConfidenceLevel; alpha := 1.0 - FConfidenceLevel;
t := FitStatistics.tValue; t := FitStatistics.tValue;
// t := invtdist(alpha, FitStatistics.DOF, 2);
ALower := val - sig*t; ALower := val - sig*t;
AUpper := val + sig*t; AUpper := val + sig*t;
if (FFitEquation in [feExp, fePower]) and (AIndex = 0) then begin if (FFitEquation in [feExp, fePower]) and (AIndex = 0) then begin
@ -1750,14 +1749,16 @@ end;
procedure TFitSeries.GetInterval(const aX: Double; out AY: Double; procedure TFitSeries.GetInterval(const aX: Double; out AY: Double;
IsUpper, IsPrediction: Boolean); IsUpper, IsPrediction: Boolean);
var var
y: Double; x,y: Double;
dy: Double; dy: Double;
Offs: Double; Offs: Double;
begin begin
offs := IfThen(IsPrediction, 1, 0); offs := IfThen(IsPrediction, 1, 0);
with FitStatistics do begin with FitStatistics do begin
y := TransformY(Calculate(AX)); x := TransformX(AX);
dy := tValue * ResidualStdError * sqrt(offs + 1/N + sqr(AX - xBar) / SSx); y := Calculate(AX);
y := TransformY(y);
dy := tValue * ResidualStdError * sqrt(offs + 1/N + sqr(x - xBar) / SSx);
if IsUpper then if IsUpper then
AY := y + dy AY := y + dy
else else