From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,608f4b25931220fc X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-01-26 17:50:36 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!chcgil2-snh1.gtei.net!news.bbnplanet.com!wn11feed!worldnet.att.net!attbi_feed3!attbi.com!attbi_s01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: OT: Incremental statistics functions References: <86k73e9uzk.fsf@lucretia.kaos> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 67.161.24.134 X-Complaints-To: abuse@comcast.net X-Trace: attbi_s01 1075168235 67.161.24.134 (Tue, 27 Jan 2004 01:50:35 GMT) NNTP-Posting-Date: Tue, 27 Jan 2004 01:50:35 GMT Organization: Comcast Online Date: Tue, 27 Jan 2004 01:50:35 GMT Xref: archiver1.google.com comp.lang.ada:4864 Date: 2004-01-27T01:50:35+00:00 List-Id: >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;