Author: CPK Smithies
Posted on: 2012-12-20
Very many authors of statistical algorithms calculate standard deviations and variances in procedural code rather than using an object-oriented solution. Typically, they follow the technique of building arrays of squares for each data pair.
In fact, this is unnecessary and wasteful of storage, as all the values needed to calculate standard deviations and variances can be calculated "on the fly" without any need for arrays; this has the added benefit that the storage requirement is independent of the sample size (i.e. the number of data pairs).
I hope to provide a working example to demonstrate how a more complex statistical class can be simplified, clarified and made much more efficient by making use of the meansdev class.
You need to be a registered user or login to post a comment
1,411,262 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
No comments were submitted yet.