From: tmoran@acm.org
Subject: Re: OT: Incremental statistics functions
Date: Tue, 27 Jan 2004 01:50:35 GMT
Date: 2004-01-27T01:50:35+00:00 [thread overview]
Message-ID: <LtjRb.154984$I06.1574337@attbi_s01> (raw)
In-Reply-To: 86k73e9uzk.fsf@lucretia.kaos
>I'm trying to find algorithms to calculate standard-deviation and variance
>_without_ keeping a buffer of the samples. I'm not really shure if I'm right
I don't think I understand what you want. You need only keep the
current count, sum, and sum of squares, as long as N is small and loss of
accuracy when adding a small number to a large sum isn't a problem. If
that's all you need, I can send you my q&d regression package with spec:
package Regress is
type Accumulator_Type is private;
procedure Reset(Acc : in out Accumulator_Type);
procedure Datum(X, Y : in Float;
Acc : in out Accumulator_Type);
function N(Acc : Accumulator_Type) return Natural;
function Avg_X(Acc : Accumulator_Type) return Float;
function Avg_Y(Acc : Accumulator_Type) return Float;
function Sd_X(Acc : Accumulator_Type) return Float;
function Sd_Y(Acc : Accumulator_Type) return Float;
function R(Acc : Accumulator_Type) return Float;
function A(Acc : Accumulator_Type) return Float;
function B(Acc : Accumulator_Type) return Float;
private
type Accumulator_Type is record
N : Natural := 0;
Sumx, Sumy, Sumxy, Sumx2, Sumy2 : Float := 0.0;
end record;
end Regress;
next prev parent reply other threads:[~2004-01-27 1:50 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-26 22:59 OT: Incremental statistics functions Mats Karlssohn
2004-01-27 1:50 ` tmoran [this message]
2004-01-27 2:13 ` Stephen Leake
2004-01-27 3:37 ` Robert I. Eachus
2004-01-27 4:56 ` tmoran
2004-01-28 0:22 ` tmoran
2004-01-28 19:56 ` OT: large sums; was " tmoran
2004-01-27 3:39 ` Steve
2004-01-27 16:22 ` Robert I. Eachus
2004-01-27 15:48 ` Joachim Schr�er
2004-01-28 0:22 ` tmoran
2004-01-27 23:44 ` OT: " Mats Karlssohn
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox