I am testing to use one of perl's modules, Statistics :: Sequences :: Runs. I tried to run the example in the path below, but I get an error. https://metacpan.org/pod/Statistics::Sequences::Runs
The code below is example code, and the last line is an error message that is output when this code is executed.
use Statistics::Sequences::Runs;
use Statistics::Data::Dichotomize;
my @targets = (qw/p c p w s p r w p c r c r s s s s r w p r w c w c/);
my @responses = (qw/p c s c s s p r w r w c c s s r w s w p c r w p r/);
# Test for runs of matches between targets and responses:
my $runs = Statistics::Sequences::Runs->new();
my $ddat = Statistics::Data::Dichotomize->new();
$runs->load($ddat->match(data => [\@targets, \@responses]));
$runs->dump_data(delim => ' '); # have a look at the match sequence; prints "1 1 0 0 1 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 0 0 0 0\n"
print "Probability of these many runs vs expectation: ", $runs->test(), "\n"; # 0.51436
# or test for runs in matching when responses are matched to targets one trial behind:
print $runs->test(data => $ddat->match(data => [\@targets, \@responses], lag => -1)), "\n"; # 0.73766
Can't locate object method "dump_data" via package "Statistics::Sequences::Runs" at example.pl line 10.
Does anyone know how to fix this error?
dump_dataanywhere in its inheritance tree (contrary to what the docs suggest and what @jjmerelo said). There's adump_valsmethod (in Statistics::Data, the base class of the base class of Statistics::Sequences::Runs) that takes adelimsoption. Is that the method you want? - ikegami