officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu | 8 sc/Library_sc.mk | 1 sc/UIConfig_scalc.mk | 1 sc/inc/sc.hrc | 3 sc/sdi/cellsh.sdi | 1 sc/sdi/scalc.sdi | 24 sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx | 2 sc/source/ui/StatisticsDialogs/FTestDialog.cxx | 52 - sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc | 87 +- sc/source/ui/StatisticsDialogs/StatisticsDialogs.src | 77 +- sc/source/ui/StatisticsDialogs/TTestDialog.cxx | 35 - sc/source/ui/StatisticsDialogs/ZTestDialog.cxx | 179 +++++ sc/source/ui/app/scdll.cxx | 1 sc/source/ui/inc/ZTestDialog.hxx | 34 + sc/source/ui/inc/reffact.hxx | 7 sc/source/ui/view/cellsh1.cxx | 10 sc/source/ui/view/tabvwsh.cxx | 1 sc/source/ui/view/tabvwshc.cxx | 7 sc/uiconfig/scalc/menubar/menubar.xml | 1 sc/uiconfig/scalc/ui/ztestdialog.ui | 319 ++++++++++ 20 files changed, 746 insertions(+), 104 deletions(-)
New commits: commit 84a32aae9f08cd88398093b31cc51d7d73d430ac Author: Tomaž Vajngerl <[email protected]> Date: Sat Nov 15 18:15:35 2014 +0100 t-test & F-test Statistics dialog: rename VAR -> VARIABLE Change-Id: I51fb7cb025f4dc2bb7f3bf0ba5c9b8ee90298cd8 diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx index 000687d..e18deb5 100644 --- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx @@ -28,9 +28,6 @@ #include "FTestDialog.hxx" -static const char strWildcardVariable1Range[] = "%VAR1_RANGE%"; -static const char strWildcardVariable2Range[] = "%VAR2_RANGE%"; - ScFTestDialog::ScFTestDialog( SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent, ScViewData* pViewData ) : @@ -72,8 +69,8 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) else pVariable2Iterator.reset(new DataRangeByRowIterator(mVariable2Range)); - aTemplate.autoReplaceRange(strWildcardVariable1Range, pVariable1Iterator->get()); - aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get()); + aTemplate.autoReplaceRange("%VARIABLE1_RANGE%", pVariable1Iterator->get()); + aTemplate.autoReplaceRange("%VARIABLE2_RANGE%", pVariable2Iterator->get()); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME)); aOutput.newLine(); @@ -93,63 +90,63 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN)); aOutput.nextColumn(); - aTemplate.setTemplate("=AVERAGE(%VAR1_RANGE%)"); + aTemplate.setTemplate("=AVERAGE(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.nextColumn(); - aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)"); + aTemplate.setTemplate("=AVERAGE(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE)); aOutput.nextColumn(); - aTemplate.setTemplate("=VAR(%VAR1_RANGE%)"); + aTemplate.setTemplate("=VAR(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR1_VARIANCE%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE1_VARIANCE%", aOutput.current()); aOutput.nextColumn(); - aTemplate.setTemplate("=VAR(%VAR2_RANGE%)"); + aTemplate.setTemplate("=VAR(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE2_VARIANCE%", aOutput.current()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVATIONS_LABEL)); aOutput.nextColumn(); - aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)"); + aTemplate.setTemplate("=COUNT(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR1_OBSERVATIONS%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE1_OBSERVATIONS%", aOutput.current()); aOutput.nextColumn(); - aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)"); + aTemplate.setTemplate("=COUNT(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR2_OBSERVATIONS%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE2_OBSERVATIONS%", aOutput.current()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF)); aOutput.nextColumn(); - aTemplate.setTemplate("=%VAR1_OBSERVATIONS% - 1"); + aTemplate.setTemplate("=%VARIABLE1_OBSERVATIONS% - 1"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR1_DEGREE_OF_FREEDOM%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE1_DEGREE_OF_FREEDOM%", aOutput.current()); aOutput.nextColumn(); - aTemplate.setTemplate("=%VAR2_OBSERVATIONS% - 1"); + aTemplate.setTemplate("=%VARIABLE2_OBSERVATIONS% - 1"); aOutput.writeFormula(aTemplate.getTemplate()); - aTemplate.autoReplaceAddress("%VAR2_DEGREE_OF_FREEDOM%", aOutput.current()); + aTemplate.autoReplaceAddress("%VARIABLE2_DEGREE_OF_FREEDOM%", aOutput.current()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_F)); aOutput.nextColumn(); - aTemplate.setTemplate("=%VAR1_VARIANCE% / %VAR2_VARIANCE%"); + aTemplate.setTemplate("=%VARIABLE1_VARIANCE% / %VARIABLE2_VARIANCE%"); aOutput.writeFormula(aTemplate.getTemplate()); aTemplate.autoReplaceAddress("%F_VALUE%", aOutput.current()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_P_RIGHT_TAIL)); aOutput.nextColumn(); - aTemplate.setTemplate("=FDIST(%F_VALUE%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); + aTemplate.setTemplate("=FDIST(%F_VALUE%; %VARIABLE1_DEGREE_OF_FREEDOM%; %VARIABLE2_DEGREE_OF_FREEDOM%)"); aOutput.writeFormula(aTemplate.getTemplate()); aTemplate.autoReplaceAddress("%P_RIGHT_TAIL_VALUE%", aOutput.current()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_RIGHT_TAIL)); aOutput.nextColumn(); - aTemplate.setTemplate("=FINV(%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); + aTemplate.setTemplate("=FINV(%ALPHA%; %VARIABLE1_DEGREE_OF_FREEDOM%; %VARIABLE2_DEGREE_OF_FREEDOM%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); @@ -162,7 +159,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_LEFT_TAIL)); aOutput.nextColumn(); - aTemplate.setTemplate("=FINV(1-%ALPHA%; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); + aTemplate.setTemplate("=FINV(1-%ALPHA%; %VARIABLE1_DEGREE_OF_FREEDOM%; %VARIABLE2_DEGREE_OF_FREEDOM%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); @@ -174,10 +171,10 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_F_CRITICAL_TWO_TAIL)); aOutput.nextColumn(); - aTemplate.setTemplate("=FINV(1-(%ALPHA%/2); %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); + aTemplate.setTemplate("=FINV(1-(%ALPHA%/2); %VARIABLE1_DEGREE_OF_FREEDOM%; %VARIABLE2_DEGREE_OF_FREEDOM%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.nextColumn(); - aTemplate.setTemplate("=FINV(%ALPHA%/2; %VAR1_DEGREE_OF_FREEDOM%; %VAR2_DEGREE_OF_FREEDOM%)"); + aTemplate.setTemplate("=FINV(%ALPHA%/2; %VARIABLE1_DEGREE_OF_FREEDOM%; %VARIABLE2_DEGREE_OF_FREEDOM%)"); aOutput.writeFormula(aTemplate.getTemplate()); return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress); diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx index 615cca4..17c4bfe 100644 --- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx @@ -28,9 +28,6 @@ #include "TTestDialog.hxx" -static const char strWildcardVariable1Range[] = "%VAR1_RANGE%"; -static const char strWildcardVariable2Range[] = "%VAR2_RANGE%"; - ScTTestDialog::ScTTestDialog( SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, vcl::Window* pParent, ScViewData* pViewData ) : @@ -72,8 +69,8 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) else pVariable2Iterator.reset(new DataRangeByRowIterator(mVariable2Range)); - aTemplate.autoReplaceRange(strWildcardVariable1Range, pVariable1Iterator->get()); - aTemplate.autoReplaceRange(strWildcardVariable2Range, pVariable2Iterator->get()); + aTemplate.autoReplaceRange("%VARIABLE1_RANGE%", pVariable1Iterator->get()); + aTemplate.autoReplaceRange("%VARIABLE2_RANGE%", pVariable2Iterator->get()); aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_UNDO_NAME)); aOutput.newLine(); @@ -100,43 +97,43 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN)); aOutput.nextColumn(); - aTemplate.setTemplate("=AVERAGE(%VAR1_RANGE%)"); + aTemplate.setTemplate("=AVERAGE(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.nextColumn(); - aTemplate.setTemplate("=AVERAGE(%VAR2_RANGE%)"); + aTemplate.setTemplate("=AVERAGE(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_VARIANCE)); aOutput.nextColumn(); - aTemplate.setTemplate("=VAR(%VAR1_RANGE%)"); + aTemplate.setTemplate("=VAR(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.nextColumn(); - aTemplate.setTemplate("=VAR(%VAR2_RANGE%)"); + aTemplate.setTemplate("=VAR(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); // Observations aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVATIONS_LABEL)); aOutput.nextColumn(); - aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)"); + aTemplate.setTemplate("=COUNT(%VARIABLE1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.nextColumn(); - aTemplate.setTemplate("=COUNT(%VAR2_RANGE%)"); + aTemplate.setTemplate("=COUNT(%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); // Pearson Correlation aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_PEARSON_CORRELATION)); aOutput.nextColumn(); - aTemplate.setTemplate("=CORREL(%VAR1_RANGE%;%VAR2_RANGE%)"); + aTemplate.setTemplate("=CORREL(%VARIABLE1_RANGE%;%VARIABLE2_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); aOutput.newLine(); // Observed mean difference - aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_OBSERVED_MEAN_DIFFERENCE)); + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVED_MEAN_DIFFERENCE_LABEL)); aOutput.nextColumn(); - aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))"); + aTemplate.setTemplate("=AVERAGE(IF(ISODD(IF(ISNUMBER(%VARIABLE1_RANGE%); 1; 0) * IF(ISNUMBER(%VARIABLE2_RANGE%); 1; 0)); %VARIABLE1_RANGE% - %VARIABLE2_RANGE%; \"NA\"))"); aOutput.writeMatrixFormula(aTemplate.getTemplate()); aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current()); aOutput.newLine(); @@ -144,7 +141,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) // Variance of the Differences aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_VARIANCE_OF_THE_DIFFERENCES)); aOutput.nextColumn(); - aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)); %VAR1_RANGE% - %VAR2_RANGE%; \"NA\"))"); + aTemplate.setTemplate("=VAR(IF(ISODD(IF(ISNUMBER(%VARIABLE1_RANGE%); 1; 0) * IF(ISNUMBER(%VARIABLE2_RANGE%); 1; 0)); %VARIABLE1_RANGE% - %VARIABLE2_RANGE%; \"NA\"))"); aOutput.writeMatrixFormula(aTemplate.getTemplate()); aTemplate.autoReplaceAddress("%VARIANCE_OF_DIFFERENCES%", aOutput.current()); aOutput.newLine(); @@ -152,7 +149,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) // df aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ANOVA_LABEL_DF)); aOutput.nextColumn(); - aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VAR1_RANGE%); 1; 0) * IF(ISNUMBER(%VAR2_RANGE%); 1; 0)) - 1"); + aTemplate.setTemplate("=SUM(IF(ISNUMBER(%VARIABLE1_RANGE%); 1; 0) * IF(ISNUMBER(%VARIABLE2_RANGE%); 1; 0)) - 1"); aOutput.writeMatrixFormula(aTemplate.getTemplate()); aTemplate.autoReplaceAddress("%DEGREE_OF_FREEDOM%", aOutput.current()); aOutput.newLine(); commit 475c2a083965cf358414f9ddb7d8e191f547a9d9 Author: Tomaž Vajngerl <[email protected]> Date: Sat Nov 15 18:13:45 2014 +0100 fdo#74669 Add z-test Statistics Dialog Change-Id: I8169e9ceefc48c06b358d5a8e1fc08dabf019eb3 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu index 85053c0..1054efc 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu @@ -747,6 +747,14 @@ <value>1</value> </prop> </node> + <node oor:name=".uno:ZTestDialog" oor:op="replace"> + <prop oor:name="Label" oor:type="xs:string"> + <value xml:lang="en-US">~z-test...</value> + </prop> + <prop oor:name="Properties" oor:type="xs:int"> + <value>1</value> + </prop> + </node> <node oor:name=".uno:EditHeaderAndFooter" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> <value xml:lang="en-US">~Headers & Footers...</value> diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index 042fc15..2c591c9 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -506,6 +506,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/StatisticsDialogs/StatisticsTwoVariableDialog \ sc/source/ui/StatisticsDialogs/TableFillingAndNavigationTools \ sc/source/ui/StatisticsDialogs/TTestDialog \ + sc/source/ui/StatisticsDialogs/ZTestDialog \ sc/source/ui/undo/areasave \ sc/source/ui/undo/refundo \ sc/source/ui/undo/target \ diff --git a/sc/UIConfig_scalc.mk b/sc/UIConfig_scalc.mk index 1dc9bc4..9bcc908 100644 --- a/sc/UIConfig_scalc.mk +++ b/sc/UIConfig_scalc.mk @@ -184,6 +184,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/scalc,\ sc/uiconfig/scalc/ui/validationcriteriapage \ sc/uiconfig/scalc/ui/validationhelptabpage \ sc/uiconfig/scalc/ui/xmlsourcedialog \ + sc/uiconfig/scalc/ui/ztestdialog \ )) # vim: set noet sw=4 ts=4: diff --git a/sc/inc/sc.hrc b/sc/inc/sc.hrc index 0287773..155ef28 100644 --- a/sc/inc/sc.hrc +++ b/sc/inc/sc.hrc @@ -271,7 +271,8 @@ #define SID_MOVING_AVERAGE_DIALOG (SC_MESSAGE_START + 77) #define SID_TTEST_DIALOG (SC_MESSAGE_START + 78) #define SID_FTEST_DIALOG (SC_MESSAGE_START + 79) -#define SID_SEARCH_RESULTS_DIALOG (SC_MESSAGE_START + 80) +#define SID_ZTEST_DIALOG (SC_MESSAGE_START + 80) +#define SID_SEARCH_RESULTS_DIALOG (SC_MESSAGE_START + 81) // functions diff --git a/sc/sdi/cellsh.sdi b/sc/sdi/cellsh.sdi index 9bc9444..287af98 100644 --- a/sc/sdi/cellsh.sdi +++ b/sc/sdi/cellsh.sdi @@ -161,6 +161,7 @@ interface CellSelection SID_MOVING_AVERAGE_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_TTEST_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_FTEST_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] + SID_ZTEST_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_SEARCH_RESULTS_DIALOG [ ExecMethod = ExecuteEdit; StateMethod = GetBlockState; ] SID_MARKDATAAREA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ] SID_MARKARRAYFORMULA [ ExecMethod = ExecuteMove; StateMethod = GetStateCursor; ] diff --git a/sc/sdi/scalc.sdi b/sc/sdi/scalc.sdi index f9c6cc7..72eedc6 100644 --- a/sc/sdi/scalc.sdi +++ b/sc/sdi/scalc.sdi @@ -3207,6 +3207,30 @@ SfxVoidItem FTestDialog SID_FTEST_DIALOG GroupId = GID_OPTIONS; ] +SfxVoidItem ZTestDialog SID_ZTEST_DIALOG +() +[ + /* flags: */ + AutoUpdate = FALSE, + Cachable = Cachable, + FastCall = FALSE, + HasCoreId = FALSE, + HasDialog = TRUE, + ReadOnlyDoc = TRUE, + Toggle = FALSE, + Container = FALSE, + RecordAbsolute = FALSE, + RecordPerSet; + Synchron; + + /* config: */ + AccelConfig = TRUE, + MenuConfig = TRUE, + StatusBarConfig = FALSE, + ToolBoxConfig = TRUE, + GroupId = GID_OPTIONS; +] + SfxVoidItem SolverDialog SID_OPENDLG_OPTSOLVER () [ diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc index 2574797..c4fdd4c 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc @@ -59,6 +59,8 @@ #define STR_TTEST_UNDO_NAME 67 #define STR_FTEST 68 #define STR_FTEST_UNDO_NAME 69 +#define STR_ZTEST 70 +#define STR_ZTEST_UNDO_NAME 71 #define STR_COLUMN_LABEL_TEMPLATE 100 #define STR_ROW_LABEL_TEMPLATE 101 @@ -84,6 +86,7 @@ #define STR_VARIABLE_2_LABEL 134 #define STR_HYPOTHESIZED_MEAN_DIFFERENCE_LABEL 135 #define STR_OBSERVATIONS_LABEL 136 +#define STR_OBSERVED_MEAN_DIFFERENCE_LABEL 137 #define STR_FTEST_P_RIGHT_TAIL 140 #define STR_FTEST_F_CRITICAL_RIGHT_TAIL 141 @@ -93,7 +96,6 @@ #define STR_FTEST_F_CRITICAL_TWO_TAIL 145 #define STR_TTEST_PEARSON_CORRELATION 150 -#define STR_TTEST_OBSERVED_MEAN_DIFFERENCE 151 #define STR_TTEST_VARIANCE_OF_THE_DIFFERENCES 152 #define STR_TTEST_T_STAT 153 #define STR_TTEST_P_ONE_TAIL 154 @@ -101,4 +103,11 @@ #define STR_TTEST_P_TWO_TAIL 156 #define STR_TTEST_T_CRITICAL_TWO_TAIL 157 +#define STR_ZTEST_KNOWN_VARIANCE 160 +#define STR_ZTEST_Z_VALUE 161 +#define STR_ZTEST_P_ONE_TAIL 162 +#define STR_ZTEST_Z_CRITICAL_ONE_TAIL 163 +#define STR_ZTEST_P_TWO_TAIL 164 +#define STR_ZTEST_Z_CRITICAL_TWO_TAIL 165 + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src index 49c9575..f686562 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src @@ -292,6 +292,14 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "t-test"; }; + String STR_ZTEST + { + Text [ en-US ] = "z-test"; + }; + String STR_ZTEST_UNDO_NAME + { + Text [ en-US ] = "z-test"; + }; /* Common */ String STR_COLUMN_LABEL_TEMPLATE @@ -322,6 +330,10 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "Observations"; }; + String STR_OBSERVED_MEAN_DIFFERENCE_LABEL + { + Text [ en-US ] = "Observed Mean Difference"; + }; /*F Test */ String STR_FTEST_P_RIGHT_TAIL @@ -354,10 +366,6 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "Pearson Correlation"; }; - String STR_TTEST_OBSERVED_MEAN_DIFFERENCE - { - Text [ en-US ] = "Observed Mean Difference"; - }; String STR_TTEST_VARIANCE_OF_THE_DIFFERENCES { Text [ en-US ] = "Variance of the Differences"; @@ -382,6 +390,32 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "t Critical two-tail"; }; + + /*Z Test*/ + String STR_ZTEST_Z_VALUE + { + Text [ en-US ] = "z"; + }; + String STR_ZTEST_KNOWN_VARIANCE + { + Text [ en-US ] = "Known Variance"; + }; + String STR_ZTEST_P_ONE_TAIL + { + Text [ en-US ] = "P (Z<=z) one-tail"; + }; + String STR_ZTEST_Z_CRITICAL_ONE_TAIL + { + Text [ en-US ] = "z Critical one-tail"; + }; + String STR_ZTEST_P_TWO_TAIL + { + Text [ en-US ] = "P (Z<=z) two-tail"; + }; + String STR_ZTEST_Z_CRITICAL_TWO_TAIL + { + Text [ en-US ] = "z Critical two-tail"; + }; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx new file mode 100644 index 0000000..4ab24c4 --- /dev/null +++ b/sc/source/ui/StatisticsDialogs/ZTestDialog.cxx @@ -0,0 +1,179 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#include <sfx2/dispatch.hxx> +#include <svl/zforlist.hxx> +#include <svl/undo.hxx> +#include <boost/random.hpp> +#include <boost/scoped_ptr.hpp> + +#include "formulacell.hxx" +#include "rangelst.hxx" +#include "scitems.hxx" +#include "docsh.hxx" +#include "document.hxx" +#include "uiitems.hxx" +#include "reffact.hxx" +#include "strload.hxx" +#include "docfunc.hxx" +#include "StatisticsDialogs.hrc" +#include "TableFillingAndNavigationTools.hxx" + +#include "ZTestDialog.hxx" + +ScZTestDialog::ScZTestDialog( + SfxBindings* pSfxBindings, SfxChildWindow* pChildWindow, + vcl::Window* pParent, ScViewData* pViewData ) : + ScStatisticsTwoVariableDialog( + pSfxBindings, pChildWindow, pParent, pViewData, + "ZTestDialog", "modules/scalc/ui/ztestdialog.ui" ) +{ + SetText(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST)); +} + +ScZTestDialog::~ScZTestDialog() +{} + +bool ScZTestDialog::Close() +{ + return DoClose( ScZTestDialogWrapper::GetChildWindowId() ); +} + +sal_Int16 ScZTestDialog::GetUndoNameId() +{ + return STR_ZTEST_UNDO_NAME; +} + +ScRange ScZTestDialog::ApplyOutput(ScDocShell* pDocShell) +{ + AddressWalkerWriter aOutput(mOutputAddress, pDocShell, mDocument, + formula::FormulaGrammar::mergeToGrammar( formula::FormulaGrammar::GRAM_ENGLISH, mAddressDetails.eConv)); + FormulaTemplate aTemplate(mDocument); + + boost::scoped_ptr<DataRangeIterator> pVariable1Iterator; + if (mGroupedBy == BY_COLUMN) + pVariable1Iterator.reset(new DataRangeByColumnIterator(mVariable1Range)); + else + pVariable1Iterator.reset(new DataRangeByRowIterator(mVariable1Range)); + + boost::scoped_ptr<DataRangeIterator> pVariable2Iterator; + if (mGroupedBy == BY_COLUMN) + pVariable2Iterator.reset(new DataRangeByColumnIterator(mVariable2Range)); + else + pVariable2Iterator.reset(new DataRangeByRowIterator(mVariable2Range)); + + aTemplate.autoReplaceRange("%VARIABLE1_RANGE%", pVariable1Iterator->get()); + aTemplate.autoReplaceRange("%VARIABLE2_RANGE%", pVariable2Iterator->get()); + + aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST)); + aOutput.newLine(); + + // Alpha + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_LABEL_ALPHA)); + aOutput.nextColumn(); + aOutput.writeValue(0.05); + aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current()); + aOutput.newLine(); + + // Hypothesized mean difference + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_HYPOTHESIZED_MEAN_DIFFERENCE_LABEL)); + aOutput.nextColumn(); + aOutput.writeValue(0); + aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current()); + aOutput.newLine(); + + // Variable Label + aOutput.nextColumn(); + aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_1_LABEL)); + aOutput.nextColumn(); + aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_VARIABLE_2_LABEL)); + aOutput.newLine(); + + // Known Variance + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_KNOWN_VARIANCE)); + aOutput.nextColumn(); + aOutput.writeValue(0); + aTemplate.autoReplaceAddress("%KNOWN_VARIANCE_VARIABLE1%", aOutput.current()); + aOutput.nextColumn(); + aOutput.writeValue(0); + aTemplate.autoReplaceAddress("%KNOWN_VARIANCE_VARIABLE2%", aOutput.current()); + aOutput.newLine(); + + // Mean + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STRID_CALC_MEAN)); + aOutput.nextColumn(); + aTemplate.setTemplate("=AVERAGE(%VARIABLE1_RANGE%)"); + aTemplate.autoReplaceAddress("%MEAN_VARIABLE1%", aOutput.current()); + aOutput.writeFormula(aTemplate.getTemplate()); + aOutput.nextColumn(); + aTemplate.setTemplate("=AVERAGE(%VARIABLE2_RANGE%)"); + aTemplate.autoReplaceAddress("%MEAN_VARIABLE2%", aOutput.current()); + aOutput.writeFormula(aTemplate.getTemplate()); + aOutput.newLine(); + + // Observations + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVATIONS_LABEL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=COUNT(%VARIABLE1_RANGE%)"); + aOutput.writeFormula(aTemplate.getTemplate()); + aTemplate.autoReplaceAddress("%OBSERVATION_VARIABLE1%", aOutput.current()); + aOutput.nextColumn(); + aTemplate.setTemplate("=COUNT(%VARIABLE2_RANGE%)"); + aOutput.writeFormula(aTemplate.getTemplate()); + aTemplate.autoReplaceAddress("%OBSERVATION_VARIABLE2%", aOutput.current()); + aOutput.newLine(); + + // Observed mean difference + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVED_MEAN_DIFFERENCE_LABEL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=%MEAN_VARIABLE1% - %MEAN_VARIABLE2%"); + aOutput.writeMatrixFormula(aTemplate.getTemplate()); + aTemplate.autoReplaceAddress("%OBSERVED_MEAN_DIFFERENCE%", aOutput.current()); + aOutput.newLine(); + + // z + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_Z_VALUE)); + aOutput.nextColumn(); + aTemplate.setTemplate("=(%OBSERVED_MEAN_DIFFERENCE% - %HYPOTHESIZED_MEAN_DIFFERENCE%) / SQRT( %KNOWN_VARIANCE_VARIABLE1% / %OBSERVATION_VARIABLE1% + %KNOWN_VARIANCE_VARIABLE2% / %OBSERVATION_VARIABLE2% )"); + aOutput.writeFormula(aTemplate.getTemplate()); + aTemplate.autoReplaceAddress("%Z_STAT%", aOutput.current()); + aOutput.newLine(); + + // P one-tail + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_P_ONE_TAIL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=1 - NORMSDIST(ABS(%Z_STAT%))"); + aOutput.writeFormula(aTemplate.getTemplate()); + aOutput.newLine(); + + // z critical one-tail + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_Z_CRITICAL_ONE_TAIL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=-NORMSINV(%ALPHA%)"); + aOutput.writeFormula(aTemplate.getTemplate()); + aOutput.newLine(); + + // P two-tail + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_P_TWO_TAIL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=2 * NORMSDIST(-ABS(%Z_STAT%))"); + aOutput.writeFormula(aTemplate.getTemplate()); + aOutput.newLine(); + + // z critical two-tail + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_ZTEST_Z_CRITICAL_TWO_TAIL)); + aOutput.nextColumn(); + aTemplate.setTemplate("=-NORMSINV(%ALPHA%/2)"); + aOutput.writeFormula(aTemplate.getTemplate()); + + return ScRange(aOutput.mMinimumAddress, aOutput.mMaximumAddress); +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/app/scdll.cxx b/sc/source/ui/app/scdll.cxx index d945222..d620049 100644 --- a/sc/source/ui/app/scdll.cxx +++ b/sc/source/ui/app/scdll.cxx @@ -259,6 +259,7 @@ void ScDLL::Init() ScMovingAverageDialogWrapper ::RegisterChildWindow(false, pMod); ScTTestDialogWrapper ::RegisterChildWindow(false, pMod); ScFTestDialogWrapper ::RegisterChildWindow(false, pMod); + ScZTestDialogWrapper ::RegisterChildWindow(false, pMod); // First docking Window for Calc ScFunctionChildWindow ::RegisterChildWindow(false, pMod); diff --git a/sc/source/ui/inc/ZTestDialog.hxx b/sc/source/ui/inc/ZTestDialog.hxx new file mode 100644 index 0000000..8af6f14 --- /dev/null +++ b/sc/source/ui/inc/ZTestDialog.hxx @@ -0,0 +1,34 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + */ + +#ifndef INCLUDED_SC_SOURCE_UI_INC_ZTESTDIALOG_HXX +#define INCLUDED_SC_SOURCE_UI_INC_ZTESTDIALOG_HXX + +#include "StatisticsTwoVariableDialog.hxx" + +class ScZTestDialog : public ScStatisticsTwoVariableDialog +{ +public: + ScZTestDialog( + SfxBindings* pB, SfxChildWindow* pCW, + vcl::Window* pParent, ScViewData* pViewData ); + + virtual ~ScZTestDialog(); + + virtual bool Close() SAL_OVERRIDE; + +protected: + virtual sal_Int16 GetUndoNameId() SAL_OVERRIDE; + virtual ScRange ApplyOutput(ScDocShell* pDocShell) SAL_OVERRIDE; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 7ae4a9f..4fd3b27 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -121,6 +121,13 @@ private: ScFTestDialogWrapper() SAL_DELETED_FUNCTION; }; +class ScZTestDialogWrapper : + public ChildWindowWrapper<SID_ZTEST_DIALOG> +{ +private: + ScZTestDialogWrapper() SAL_DELETED_FUNCTION; +}; + class ScAcceptChgDlgWrapper: public SfxChildWindow { public: diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index 32c237d..624b77d 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -992,6 +992,16 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) } break; + case SID_ZTEST_DIALOG: + { + sal_uInt16 nId = ScZTestDialogWrapper::GetChildWindowId(); + SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); + SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); + + pScMod->SetRefDialog( nId, pWnd ? false : sal_True ); + + } + break; case SID_SEARCH_RESULTS_DIALOG: { diff --git a/sc/source/ui/view/tabvwsh.cxx b/sc/source/ui/view/tabvwsh.cxx index 51aaae8..d07feb7 100644 --- a/sc/source/ui/view/tabvwsh.cxx +++ b/sc/source/ui/view/tabvwsh.cxx @@ -95,6 +95,7 @@ void ScTabViewShell::InitInterface_Impl() GetStaticInterface()->RegisterChildWindow(ScMovingAverageDialogWrapper::GetChildWindowId()); GetStaticInterface()->RegisterChildWindow(ScTTestDialogWrapper::GetChildWindowId()); GetStaticInterface()->RegisterChildWindow(ScFTestDialogWrapper::GetChildWindowId()); + GetStaticInterface()->RegisterChildWindow(ScZTestDialogWrapper::GetChildWindowId()); } SFX_IMPL_NAMED_VIEWFACTORY( ScTabViewShell, "Default" ) diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx index 2285768..6621d55b 100644 --- a/sc/source/ui/view/tabvwshc.cxx +++ b/sc/source/ui/view/tabvwshc.cxx @@ -68,6 +68,7 @@ #include "MovingAverageDialog.hxx" #include "TTestDialog.hxx" #include "FTestDialog.hxx" +#include "ZTestDialog.hxx" #include "PivotLayoutDialog.hxx" @@ -381,6 +382,12 @@ SfxModelessDialog* ScTabViewShell::CreateRefDialog( } break; + case SID_ZTEST_DIALOG: + { + pResult = new ScZTestDialog( pB, pCW, pParent, &GetViewData() ); + } + break; + case SID_OPENDLG_OPTSOLVER: { ScViewData& rViewData = GetViewData(); diff --git a/sc/uiconfig/scalc/menubar/menubar.xml b/sc/uiconfig/scalc/menubar/menubar.xml index 00368d3..d906957 100644 --- a/sc/uiconfig/scalc/menubar/menubar.xml +++ b/sc/uiconfig/scalc/menubar/menubar.xml @@ -507,6 +507,7 @@ <menu:menuitem menu:id=".uno:MovingAverageDialog"/> <menu:menuitem menu:id=".uno:TTestDialog"/> <menu:menuitem menu:id=".uno:FTestDialog"/> + <menu:menuitem menu:id=".uno:ZTestDialog"/> </menu:menupopup> </menu:menu> </menu:menupopup> diff --git a/sc/uiconfig/scalc/ui/ztestdialog.ui b/sc/uiconfig/scalc/ui/ztestdialog.ui new file mode 100644 index 0000000..efe00ad --- /dev/null +++ b/sc/uiconfig/scalc/ui/ztestdialog.ui @@ -0,0 +1,319 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <requires lib="LibreOffice" version="1.0"/> + <object class="GtkDialog" id="ZTestDialog"> + <property name="can_focus">False</property> + <property name="border_width">6</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkBox" id="dialog-vbox1"> + <property name="can_focus">False</property> + <property name="orientation">vertical</property> + <property name="spacing">12</property> + <child> + <object class="GtkFrame" id="frame-data"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkLabel" id="variable1-range-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Variable 1 range:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">variable1-range-edit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="variable1-range-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">â¢</property> + <property name="width_chars">30</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="variable1-range-button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="variable2-range-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Variable 2 range:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">variable2-range-edit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="variable2-range-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">â¢</property> + <property name="width_chars">30</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="variable2-range-button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="output-range-label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Results to:</property> + <property name="use_underline">True</property> + <property name="mnemonic_widget">variable2-range-edit</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="foruilo-RefEdit" id="output-range-edit"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="valign">center</property> + <property name="hexpand">True</property> + <property name="invisible_char">â¢</property> + <property name="width_chars">30</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="foruilo-RefButton" id="output-range-button"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + </object> + <packing> + <property name="left_attach">2</property> + <property name="top_attach">2</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Data</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkButtonBox" id="dialog-action_area1"> + <property name="can_focus">False</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + <property name="secondary">True</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">6</property> + <property name="bottom_padding">6</property> + <property name="left_padding">12</property> + <property name="right_padding">12</property> + <child> + <object class="GtkGrid" id="grid2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">12</property> + <child> + <object class="GtkRadioButton" id="groupedby-columns-radio"> + <property name="label" translatable="yes">Columns</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="active">True</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkRadioButton" id="groupedby-rows-radio"> + <property name="label" translatable="yes">Rows</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="use_underline">True</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + <property name="group">groupedby-columns-radio</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + </child> + </object> + </child> + <child type="label"> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Grouped by</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="0">ok</action-widget> + </action-widgets> + </object> + <object class="GtkSizeGroup" id="sizegroup1"> + <widgets> + <widget name="variable1-range-label"/> + <widget name="variable2-range-label"/> + <widget name="output-range-label"/> + <widget name="groupedby-columns-radio"/> + </widgets> + </object> +</interface> commit 225af09be9ae7b10aaf5bf0e3714c74c5a2f1391 Author: Tomaž Vajngerl <[email protected]> Date: Sat Nov 15 16:05:00 2014 +0100 Make room for more IDs and rename common IDs in Statistics dialogs Change-Id: I0c7c28ef77676f8bcb6cf66423d30e3ea164a5bc diff --git a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx index 1fa3a6e..000687d 100644 --- a/sc/source/ui/StatisticsDialogs/FTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/FTestDialog.cxx @@ -78,7 +78,8 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.writeBoldString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_UNDO_NAME)); aOutput.newLine(); - aOutput.writeString("Alpha"); + // Alpha + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_LABEL_ALPHA)); aOutput.nextColumn(); aOutput.writeValue(0.05); aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current()); @@ -110,7 +111,7 @@ ScRange ScFTestDialog::ApplyOutput(ScDocShell* pDocShell) aTemplate.autoReplaceAddress("%VAR2_VARIANCE%", aOutput.current()); aOutput.newLine(); - aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL)); + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVATIONS_LABEL)); aOutput.nextColumn(); aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc index cd2bace..2574797 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc @@ -56,49 +56,49 @@ #define STR_EXPONENTIAL_SMOOTHING_UNDO_NAME 64 #define STR_MOVING_AVERAGE_UNDO_NAME 65 #define STR_TTEST 66 -#define STR_FTEST 67 -#define STR_TTEST_UNDO_NAME 68 +#define STR_TTEST_UNDO_NAME 67 +#define STR_FTEST 68 #define STR_FTEST_UNDO_NAME 69 -#define STR_COLUMN_LABEL_TEMPLATE 70 -#define STR_ROW_LABEL_TEMPLATE 71 +#define STR_COLUMN_LABEL_TEMPLATE 100 +#define STR_ROW_LABEL_TEMPLATE 101 -#define STR_ANOVA_SINGLE_FACTOR_LABEL 80 -#define STR_ANOVA_LABEL_GROUPS 81 -#define STR_ANOVA_LABEL_BETWEEN_GROUPS 82 -#define STR_ANOVA_LABEL_WITHIN_GROUPS 83 -#define STR_ANOVA_LABEL_SOURCE_OF_VARIATION 84 -#define STR_ANOVA_LABEL_SS 85 -#define STR_ANOVA_LABEL_DF 86 -#define STR_ANOVA_LABEL_MS 87 -#define STR_ANOVA_LABEL_F 88 -#define STR_ANOVA_LABEL_P_VALUE 89 -#define STR_ANOVA_LABEL_F_CRITICAL 90 -#define STR_ANOVA_LABEL_TOTAL 91 -#define STR_ANOVA_TWO_FACTOR_LABEL 92 +#define STR_ANOVA_SINGLE_FACTOR_LABEL 110 +#define STR_ANOVA_LABEL_GROUPS 111 +#define STR_ANOVA_LABEL_BETWEEN_GROUPS 112 +#define STR_ANOVA_LABEL_WITHIN_GROUPS 113 +#define STR_ANOVA_LABEL_SOURCE_OF_VARIATION 114 +#define STR_ANOVA_LABEL_SS 115 +#define STR_ANOVA_LABEL_DF 116 +#define STR_ANOVA_LABEL_MS 117 +#define STR_ANOVA_LABEL_F 118 +#define STR_ANOVA_LABEL_P_VALUE 119 +#define STR_ANOVA_LABEL_F_CRITICAL 120 +#define STR_ANOVA_LABEL_TOTAL 121 +#define STR_ANOVA_TWO_FACTOR_LABEL 122 -#define STR_CORRELATION_LABEL 100 -#define STR_COVARIANCE_LABEL 101 -#define STR_LABEL_ALPHA 102 -#define STR_VARIABLE_1_LABEL 103 -#define STR_VARIABLE_2_LABEL 104 +#define STR_CORRELATION_LABEL 130 +#define STR_COVARIANCE_LABEL 131 +#define STR_LABEL_ALPHA 132 +#define STR_VARIABLE_1_LABEL 133 +#define STR_VARIABLE_2_LABEL 134 +#define STR_HYPOTHESIZED_MEAN_DIFFERENCE_LABEL 135 +#define STR_OBSERVATIONS_LABEL 136 -#define STR_FTEST_OBSERVATIONS_LABEL 110 -#define STR_FTEST_P_RIGHT_TAIL 111 -#define STR_FTEST_F_CRITICAL_RIGHT_TAIL 112 -#define STR_FTEST_P_LEFT_TAIL 113 -#define STR_FTEST_F_CRITICAL_LEFT_TAIL 114 -#define STR_FTEST_P_TWO_TAIL 115 -#define STR_FTEST_F_CRITICAL_TWO_TAIL 116 +#define STR_FTEST_P_RIGHT_TAIL 140 +#define STR_FTEST_F_CRITICAL_RIGHT_TAIL 141 +#define STR_FTEST_P_LEFT_TAIL 142 +#define STR_FTEST_F_CRITICAL_LEFT_TAIL 143 +#define STR_FTEST_P_TWO_TAIL 144 +#define STR_FTEST_F_CRITICAL_TWO_TAIL 145 -#define STR_TTEST_PEARSON_CORRELATION 120 -#define STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE 121 -#define STR_TTEST_OBSERVED_MEAN_DIFFERENCE 122 -#define STR_TTEST_VARIANCE_OF_THE_DIFFERENCES 123 -#define STR_TTEST_T_STAT 124 -#define STR_TTEST_P_ONE_TAIL 125 -#define STR_TTEST_T_CRITICAL_ONE_TAIL 126 -#define STR_TTEST_P_TWO_TAIL 127 -#define STR_TTEST_T_CRITICAL_TWO_TAIL 128 +#define STR_TTEST_PEARSON_CORRELATION 150 +#define STR_TTEST_OBSERVED_MEAN_DIFFERENCE 151 +#define STR_TTEST_VARIANCE_OF_THE_DIFFERENCES 152 +#define STR_TTEST_T_STAT 153 +#define STR_TTEST_P_ONE_TAIL 154 +#define STR_TTEST_T_CRITICAL_ONE_TAIL 155 +#define STR_TTEST_P_TWO_TAIL 156 +#define STR_TTEST_T_CRITICAL_TWO_TAIL 157 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src index 4faf2c5..49c9575 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src @@ -276,24 +276,21 @@ Resource RID_STATISTICS_DLGS Text [ en-US ] = "Sampling"; }; - String STR_TTEST + String STR_FTEST { - Text [ en-US ] = "t-test"; + Text [ en-US ] = "F-test"; }; - - String STR_FTEST + String STR_FTEST_UNDO_NAME { Text [ en-US ] = "F-test"; }; - - String STR_TTEST_UNDO_NAME + String STR_TTEST { Text [ en-US ] = "t-test"; }; - - String STR_FTEST_UNDO_NAME + String STR_TTEST_UNDO_NAME { - Text [ en-US ] = "F-test"; + Text [ en-US ] = "t-test"; }; /* Common */ @@ -317,12 +314,16 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "Variable 2"; }; - - /*F Test */ - String STR_FTEST_OBSERVATIONS_LABEL + String STR_HYPOTHESIZED_MEAN_DIFFERENCE_LABEL + { + Text [ en-US ] = "Hypothesized Mean Difference"; + }; + String STR_OBSERVATIONS_LABEL { Text [ en-US ] = "Observations"; }; + + /*F Test */ String STR_FTEST_P_RIGHT_TAIL { Text [ en-US ] = "P (F<=f) right-tail"; @@ -353,10 +354,6 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "Pearson Correlation"; }; - String STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE - { - Text [ en-US ] = "Hypothesized Mean Difference"; - }; String STR_TTEST_OBSERVED_MEAN_DIFFERENCE { Text [ en-US ] = "Observed Mean Difference"; diff --git a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx index d61ba62..615cca4 100644 --- a/sc/source/ui/StatisticsDialogs/TTestDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/TTestDialog.cxx @@ -79,14 +79,14 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.newLine(); // Alpha - aOutput.writeString("Alpha"); + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_LABEL_ALPHA)); aOutput.nextColumn(); aOutput.writeValue(0.05); aTemplate.autoReplaceAddress("%ALPHA%", aOutput.current()); aOutput.newLine(); // Hypothesized mean difference - aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_TTEST_HYPOTHESIZED_MEAN_DIFFERENCE)); + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_HYPOTHESIZED_MEAN_DIFFERENCE_LABEL)); aOutput.nextColumn(); aOutput.writeValue(0); aTemplate.autoReplaceAddress("%HYPOTHESIZED_MEAN_DIFFERENCE%", aOutput.current()); @@ -117,7 +117,7 @@ ScRange ScTTestDialog::ApplyOutput(ScDocShell* pDocShell) aOutput.newLine(); // Observations - aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_FTEST_OBSERVATIONS_LABEL)); + aOutput.writeString(SC_STRLOAD(RID_STATISTICS_DLGS, STR_OBSERVATIONS_LABEL)); aOutput.nextColumn(); aTemplate.setTemplate("=COUNT(%VAR1_RANGE%)"); aOutput.writeFormula(aTemplate.getTemplate()); commit 817b0b51e78b6870379f595a1f370985179847df Author: Tomaž Vajngerl <[email protected]> Date: Sat Nov 15 15:55:43 2014 +0100 fdo#81801 add first and third quartile to "Descriptive Statistics" Change-Id: I7bfdb02a97d6a33c0a6e16b058cbb10b8ab2869b diff --git a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx index 485c043..363c84d 100644 --- a/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx +++ b/sc/source/ui/StatisticsDialogs/DescriptiveStatisticsDialog.cxx @@ -42,6 +42,8 @@ static const StatisticCalculation lclCalcDefinitions[] = { STRID_CALC_STD_ERROR, "=SQRT(VAR(%RANGE%)/COUNT(%RANGE%))"}, { STRID_CALC_MODE, "=MODE(%RANGE%)"}, { STRID_CALC_MEDIAN, "=MEDIAN(%RANGE%)"}, + { STRID_CALC_FIRST_QUARTILE, "=QUARTILE(%RANGE%; 1)" }, + { STRID_CALC_THIRD_QUARTILE, "=QUARTILE(%RANGE%; 3)" }, { STRID_CALC_VARIANCE, "=VAR(%RANGE%)"}, { STRID_CALC_STD_DEVIATION, "=STDEV(%RANGE%)"}, { STRID_CALC_KURTOSIS, "=KURT(%RANGE%)"}, diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc index 3cbed42..cd2bace 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.hrc @@ -46,6 +46,8 @@ #define STRID_CALC_MAX 50 #define STRID_CALC_SUM 51 #define STRID_CALC_COUNT 52 +#define STRID_CALC_FIRST_QUARTILE 53 +#define STRID_CALC_THIRD_QUARTILE 54 #define STR_DESCRIPTIVE_STATISTICS_UNDO_NAME 60 #define STR_ANALYSIS_OF_VARIANCE_UNDO_NAME 61 diff --git a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src index b084019..4faf2c5 100644 --- a/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src +++ b/sc/source/ui/StatisticsDialogs/StatisticsDialogs.src @@ -181,6 +181,14 @@ Resource RID_STATISTICS_DLGS { Text [ en-US ] = "Count"; }; + String STRID_CALC_FIRST_QUARTILE + { + Text [ en-US ] = "First Quartile "; + }; + String STRID_CALC_THIRD_QUARTILE + { + Text [ en-US ] = "Third Quartile"; + }; /* RandomNumberGeneratorDialog */
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
