Bug 86284 - t-test wrongly hypothesizes mean difference when using the statistics assistant
Summary: t-test wrongly hypothesizes mean difference when using the statistics assistant
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
4.3.3.2 release
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard: target:4.4.0 target:4.3.5
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-14 13:08 UTC by André Gillibert
Modified: 2014-11-15 13:03 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Sample Spreadsheet showing the test (30.18 KB, application/vnd.oasis.opendocument.spreadsheet)
2014-11-14 13:08 UTC, André Gillibert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description André Gillibert 2014-11-14 13:08:06 UTC
Created attachment 109462 [details]
Sample Spreadsheet showing the test

Summary:
When using the Data->Statistics->t-test menu, one can get a dialog box to auto-generate a paired t-test.
By default, the test is done with the hypothesis that the mean difference is 2 (always the number two), while in almost every case everybody wants to test the hypothesis of equal means (difference zero).
Once the table is generated, it's easy to work around this bug, by storing 0 in the cell "Hypothesized Mean Difference" (by default, it's 2).
But, it's very misleading. The hypothesized mean difference is not shown in the dialog box, and the generated "hypothesized mean difference" cell is hidden in many cells of various statistics.

Steps to reproduce:
Create two columns of numbers.
Select the data.
Go to Data->Statistics->t-test
Select an output cell
Click OK

Observed behavior:
The p-value of the test is computed based on the null hypothesis : mean((column A)-(column B)) = 2

Expected behavior:
The p-value of the test is computed based on the null hypothesis : mean((column A)-(column B)) = 0

Bugfix:
In file sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx
Replace the two lines:

aOutput.writeValue(2);
aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current());

With:
aOutput.writeValue(0);
aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current());
Comment 1 Julien Nabet 2014-11-14 19:53:03 UTC
On pc Debian x86-64 with master sources updated today, I could reproduce this.
It's been implemented like this since the beginning:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=88bece824dd012d9d9ec2812b5ba5ddd3311a5fe

Tomaz: any idea? Should we change the value, or should the parameter be part of a ui dialog?
Comment 2 Tomaz Vajngerl 2014-11-15 07:59:53 UTC
I think André's solution is good enough - except I will move "Hypothesized Mean Difference" to the top, below "Alpha". I want to move as much parameters out of the dialog as it is much easier to adjust the values afterwards without invoking the dialog again. Alpha for example is not part of the dialog too.

André thanks for reporting this.
Comment 3 Tomaz Vajngerl 2014-11-15 08:13:17 UTC
Ups.. forgot to put fdo number in the commit!

Anyway - solved by:
http://cgit.freedesktop.org/libreoffice/core/commit/?id=6b30907a926890f835c094a5afdf4c0e6d8a1d19
Comment 4 Tomaz Vajngerl 2014-11-15 08:30:34 UTC
Backport for 4-3 - https://gerrit.libreoffice.org/#/c/12449/
Comment 5 Julien Nabet 2014-11-15 13:03:07 UTC
https://gerrit.libreoffice.org/#/c/12449/ pushed now.

Thank you Tomaz for your feedback!