multipass procedures and two-pass moments are a go

Ben Pfaff <[email protected]> Mon, 29 Mar 2004 17:03:42 -0800
Newsgroups gmane.comp.gnu.fiasco.devel
Message-ID <[email protected]>
I just checked in code for multipass procedures and two-pass
moments.  For the former, use the
multipass_procedure_with_splits() function, declared in vfm.h.
It reads the active file and divides it up based on SPLIT FILE.
Each SPLIT FILE series is passed to a callback function as a
whole, packaged up into a "casefile", which is a newly invented
abstraction.

A "casefile" is an ordered collection of cases which can be read
sequentially from front to back as many times as needed.  You can
create any number of "casereaders" which can read the data.
Multiple casereaders can be active in different parts of the
casefile at once.  A casefile can exist in memory or on disk, and
you can instruct it to dump its data to disk at any time if
memory grows short, and doing so doesn't disturb the positioning
of the casereaders.

As for two-pass moments, look at moments.h.  You create a
`moments' structure with moments_create(), then pass the values
and weights to moments_pass_one() in the first pass and
moments_pass_two().  When the second pass is done you can get out
the moments with moments_calculate().  As an optimization,
moments_create() takes an argument which is the largest moment
you'll actually want to calculate.

The moments calculation is flexible enough that you can actually
skip the first pass if you like.  Then the calculation is not as
robust or as accurate, but it still works.  If one-pass moments
turn out to be important, I may implement the "provisional means"
procedure described in _SPSS Statistical Algorithms_ to see if
that improves accuracy.

Ben
-- 
"J'avais trouv'e ma religion :
 rien ne me parut plus important qu'un livre.
 La biblioth`eque, j'y voyais un temple."
--Jean-Paul Sartre