Commit d1dd5694 authored by Morten Welinder's avatar Morten Welinder

Tests: add test for regression tool.

parent e4f987e4
......@@ -18,6 +18,7 @@
# 7xxx: Features
# 70xx: Goal seek
# 71xx: Solver
# 72xx: Analysis tools
#
# 8xxx: Runs with valgrind and similar tools.
# 80xx: Valgrind
......@@ -139,6 +140,7 @@ TESTS = t1000-statfuns.pl \
t7145-solver-Eckerle4.pl \
t7146-solver-Rat43.pl \
t7147-solver-Bennett5.pl \
t7200-regression.pl \
t8000-valgrind.pl \
t8001-valgrind-xls.pl \
t8002-valgrind-gnumeric.pl \
......
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
my $expected;
{ local $/; $expected = <DATA>; }
&message ("Check regression tool.");
my $file = "$samples/tool-tests.gnumeric";
&GnumericTest::report_skip ("file $file does not exist") unless -r $file;
my %args =
('x' => 'Data!A1:A30',
'y' => 'Data!B1:B30',
);
my @args = ('--export-range=A1:G18', '--tool-test=regression');
foreach my $k (sort keys %args) {
my $v = $args{$k};
push @args, "--tool-test=$k:$v";
}
my $tmp = "tool.txt";
&GnumericTest::junkfile ($tmp);
my $cmd = &GnumericTest::quotearg ($ssconvert, @args, $file, $tmp);
print STDERR "# $cmd\n" if $GnumericTest::verbose;
system ($cmd);
my $actual = &GnumericTest::read_file ($tmp);
if ($actual ne $expected) {
&GnumericTest::dump_indented ($actual);
die "Fail\n";
} else {
print STDERR "Pass\n";
}
__DATA__
"SUMMARY OUTPUT",,"Response Variable","Column 2",,,
,,,,,,
"Regression Statistics",,,,,,
"Multiple R",0.7462523057935172,,,,,
R^2,0.5568925039021411,,,,,
"Standard Error",1.9266332107144821,,,,,
"Adjusted R^2",0.5410672361843604,,,,,
Observations,30,,,,,
,,,,,,
ANOVA,,,,,,
,df,SS,MS,F,"Significance of F",
Regression,1,130.62262009560348,130.62262009560348,35.19008422691248,2.197070097340739E-06,
Residual,28,103.93363480158382,3.7119155286279937,,,
Total,29,234.5562548971873,,,,
,,,,,,
,Coefficients,"Standard Error",t-Statistics,p-Value,0.95,0.95
Intercept,0.4134235230780967,0.7214717512990694,0.5730280116077914,0.5711994028401975,-1.0644443648864401,1.8912914110426335
"Column 1",0.24107897994182365,0.04063957822902626,5.9321230792113955,2.197070097340739E-06,0.15783257765793968,0.3243253822257076
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment