John Darrington [Sun, 11 Nov 2012 13:19:05 +0000 (14:19 +0100)]
Logistic Regression: Added categorical variable support
With this commit Logistic Regression now supports the /CATEGORICALS
subcommand, allowing a dependent variable to be regressed against one
or more categorical predictor variables.
John Darrington [Thu, 8 Nov 2012 13:33:51 +0000 (14:33 +0100)]
Categoricals.c: Ensure that categories are processed order of their categorical variable(s).
Some procedures require that categoricals are processed in a particular order.
Mathematically, the order is irrelevant, however for reporting purposes it is
sometimes required. This change adds a level of indirection, so that the codes
are allocated in ascending order of the categorical variable.
John Darrington [Tue, 6 Nov 2012 19:50:33 +0000 (20:50 +0100)]
Categoricals: Provide separate functions for effects and dummy coding.
Until now, the function categoricals_get_code_for_case returned the
"effects" coding (ie, a bipolar code). Some uses require "dummy" coding
(a binary coding). This change provides seperate functions to return
whatever is desired.
John Darrington [Fri, 2 Nov 2012 14:31:45 +0000 (15:31 +0100)]
Categoricals: Accept null pointer as subject.
Previously, certain functions would crash, or behave badly if their
argument was NULL. This change makes them do nothing, or return
default values, as appropriate. This saves callers having to always
test for NULL.
Ben Pfaff [Fri, 5 Oct 2012 04:22:42 +0000 (21:22 -0700)]
configure.ac: Increase pango minimum version from 1.20 to 1.22
Commit bd4d6e7453 (cairo: Avoid deprecated
pango_cairo_font_map_create_context().) added a dependency on pango
version 1.22 or later, but configure.ac only checked for version 1.20
or later. This commit fixes the discrepancy.
INSTALL already documented that Pango 1.22 or later was needed.
Ben Pfaff [Sun, 30 Sep 2012 19:29:33 +0000 (12:29 -0700)]
tests: Better isolate search text in test of error reporting.
Some GNU/Linux distributions print additional text on a segfault,
e.g. "Cannot exec debugger: No such file or directory", which this
test was seeing in output and interpreting as a failed test. This
commit fixes the problem by ignoring text up to the ***** line that
marks the start of the expected output.
Ben Pfaff [Wed, 26 Sep 2012 04:18:32 +0000 (21:18 -0700)]
Suppress GCC 4.7 warnings by changes to code that make it less clear.
I'm not entirely happy with these changes, because they make the code
slightly less obvious. However, it's still not really bad code, and
it's convenient to have a warning-free build.
Ben Pfaff [Wed, 26 Sep 2012 00:09:47 +0000 (17:09 -0700)]
gnumeric-reader: Add cast to suppress warning.
This suppresses a GCC warning for a mismatch between
xmlInputCloseCallback, which takes a "void *" parameter, and
gzclose(), which takes a "gzFile" (which is "struct gzFile_s *").
This came up with an upgrade from "squeeze" to "wheezy". I assume
that a gzclose prototype became visible or that gzFile changed away
from "void *".
An alternative would be to write a trampoline to just transform one
pointer type to the other, but the xmlReaderForIO() invocation
already has one function cast so a second cast doesn't make it much
worse.
Pango 1.30 that is in Debian "wheezy" has marked this function as
deprecated. The replacement pango_font_map_create_context() was
introduced in Pango 1.22, which was also in Debian "squeeze" (which
had Pango 1.28), so it seems safe to switch without worrying about
a Pango version check.
Ben Pfaff [Tue, 25 Sep 2012 22:36:50 +0000 (15:36 -0700)]
Remove variables assigned to but never used.
Each of the variables removed here was assigned a value that was
never used, the assignment didn't have any useful side effects, and
I don't see anything that the variable should have been used for.
Ben Pfaff [Tue, 25 Sep 2012 22:14:50 +0000 (15:14 -0700)]
expressions: Fix coercion of numbers to booleans at top level.
The check for the expected type in type_check() used the wrong
constant (a node type instead of an expression type) and so the
"if" test was never true. Also, OP_NUM_TO_BOOLEAN is binary, not
unary, so fixing just the test caused an assertion failure.
John Darrington [Thu, 20 Sep 2012 09:22:12 +0000 (11:22 +0200)]
src/data/data-out.c: Added assertion to catch negative values
If the contents of string does not contain a '.', then integer_digits
will end up negative, thus causing a crash later. This change adds
an assertion to catch this condition and thus make the diagnosis easier
should it ever occur.
John Darrington [Wed, 12 Sep 2012 07:26:21 +0000 (09:26 +0200)]
Perl Module: Avoid forcing scalar value into a pointer.
The code fragment: struct dictionary *dict = (void *) SvIV (dict_sv);
is dangerous. This fix uses the properl Perl XS mechanism to get
the pointer and the scalar associated with the dictionary.
Ben Pfaff [Mon, 20 Aug 2012 07:00:33 +0000 (00:00 -0700)]
sys-file-reader: Fix setjmp() technicality.
The C standards say that the compiler is allowed to optimize away
changes to local variables within a function between a call to
setjmp() and a later call to longjmp(), unless the local variables
are volatile-qualified.
The 'info' local variable in sfm_open_reader() fits this
description but wasn't volatile-qualified. This commit fixes that,
even though my compiler didn't in fact seem to have a problem with
the previous version.
Ben Pfaff [Mon, 20 Aug 2012 06:59:47 +0000 (23:59 -0700)]
sys-file-reader: Fix memory leak.
The C standards say that the compiler is allowed to optimize away
changes to local variables within a function between a call to
setjmp() and a later call to longjmp(), unless the local variables
are volatile-qualified.
The 'dict' local variable in sfm_open_reader() fits this
description but wasn't volatile-qualified. GCC in fact optimized
out the changes on my system, and this commit fixes that.
If text_to_value() fails for low_val, then this code would still
destroy high_val, even though high_val hadn't been initialized,
thus accessing indeterminate data.
Ben Pfaff [Sun, 19 Aug 2012 17:30:36 +0000 (10:30 -0700)]
psppire-dialog: Add "acceptable" predicate.
PsppireDialog already has a validity predicate that allows a dialog
to easily disable "OK" and other buttons when the dialog has not
yet been completely filled. It should usually be obvious to the
user why this is the case.
The upcoming GObjectification of the missing value dialog calls for
a different kind of predicate, one where the reason is not obvious
to the user (typically because he has just made a typo or does not
understand a variable's format). In this case, the user needs more
feedback, such as a message explaining the problem.
This commit therefore introduces a second kind of predicate, the
"accept" predicate. This predicate is only checked when the user
clicks on the "OK" button.
Ben Pfaff [Thu, 9 Aug 2012 06:27:32 +0000 (23:27 -0700)]
var-type-dialog: Convert to a GObject.
The one issue I can't figure out is why this changes the look of
the dialog box so that its height is the total height of all of
the widgets in the "middlebox", rather than the maximum height
actually needed.
Ben Pfaff [Wed, 1 Aug 2012 05:55:30 +0000 (22:55 -0700)]
ods-reader: Fix ods_file_casereader_destroy() call in open function.
zreader is a "struct zip_reader *" but ods_file_casereader_destroy()
takes a "struct casereader *". However ods_file_casereader_destroy()
doesn't actually use that argument so we might as well pass NULL.
Ben Pfaff [Mon, 30 Jul 2012 06:56:09 +0000 (23:56 -0700)]
var-type-dialog: Change entries to spin buttons, add validation.
The GtkEntry boxes used for entering and displaying width and
decimal places didn't do any validation that the width and decimal
places were valid for the selected format type, so it was possible
to enter values that couldn't actually be used. This commit changes
the GtkEntry boxes into GtkSpinButton widgets that, as a side
effect, validate correct values through their attached
GtkAdjustments. This is not just safer but easier to use.
Ben Pfaff [Sat, 28 Jul 2012 21:18:40 +0000 (14:18 -0700)]
var-type-dialog: Reduce redundancy.
var_type_dialog_set_state() and on_toggle_2() had considerable
redundant code. This reduces it by adding a new function
on_active_button_change() that generalizes the two functions. I
also personally found the previous way of showing and hiding widgets
to be hard to follow; I think that the bitmap approach used here
is more straightforward.
This also consolidates the two separate signal handlers for each
button into one, and replaces the similar functions
select_treeview_from_format() and select_treeview_from_format_type()
by three functions find_format(), find_format_type(), and
select_treeview_at_index() that total less code.
Ben Pfaff [Fri, 27 Jul 2012 06:21:54 +0000 (23:21 -0700)]
var-type-dialog: Properly adjust formats when switching buttons.
The var-type-dialog based the default new format on the variable's
existing format when a button was clicked, and attempted to adjust
the width and decimals into valid range, but the adjustment wasn't
always correct, so in some cases it could pick an invalid format.
This commit uses fmt_fix_output() instead, which will always choose
a valid output format.