in reply to RFC: Any and all comments welcome on style/technique in new module to calculate G statistic

Just a quick note (I hope to have time to look further, but certainly not tonight nor tomorrow).

Please don't make up a brand new top-level name in the Perl module heirarchy. I see you used Statistics::Distributions, so you should be familar with some of the many, many modules to be found undef Statistics:: (search CPAN for statistics and see how many hits are properly named under this root name).

Doing a quick search to learn about "G statistics", it appears that a more canonical name is a G-test so I suggest you name your module Statistics::Gtest (unfortunately, hyphen isn't an appropriate character in a module name).

I don't think it makes sense to define the primary interface based on reading a file to get the matrix of data. If I have the data in a 2-dimensional Perl array, why should I have to write that out to a file in order to perform a G-test on it? I can see offering an option to read a data file in order to produce the 2-dimensional Perl array.

s/^\s*//; s/\s*$//; if ($_) { my @row = split(/\s+­/);

You can replace all of that with:

if( /\S/ ) { my @row= split ' ', $_;

(Note that I don't like making the $_ argument to split implicit.)

Thanks for writing this and for asking for a review. Looks well-written and useful.

- tye        

  • Comment on Re: RFC: Any and all comments welcome on style/technique in new module to calculate G statistic (::Gtest)
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: RFC: Any and all comments welcome on style/technique in new module to calculate G statistic (::Gtest)
by Anonymous Monk on Jul 31, 2007 at 18:43 UTC
    i agree, interface shouldn't be primarily file-based. you might get an idea or two from my recently released module, Statistics::Benford.