[rkward-cvs] SF.net SVN: rkward:[4132] trunk/rkward/rkward/plugins
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Fri Dec 16 19:43:13 UTC 2011
Revision: 4132
http://rkward.svn.sourceforge.net/rkward/?rev=4132&view=rev
Author: m-eik
Date: 2011-12-16 19:43:13 +0000 (Fri, 16 Dec 2011)
Log Message:
-----------
added new merged wilcoxon test dialog. for comparison, left the existing one intact, for now.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/analysis.pluginmap
Added Paths:
-----------
trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.js
trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.rkh
trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.xml
Added: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.js (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.js 2011-12-16 19:43:13 UTC (rev 4132)
@@ -0,0 +1,106 @@
+function preprocess(){
+ var x = getValue("x");
+ var y = getValue("y");
+ var ties = getValue("ties");
+ if(ties) {
+ echo("\trequire(exactRankTests)\n");
+ } else {}
+ echo("\tnames <- rk.get.description (" + x);
+ if(y) {
+ echo(", " + y);
+ } else {}
+ echo(")\n");
+}
+
+function calculate(){
+ // read in variables from dialog
+ var x = getValue("x");
+ var y = getValue("y");
+ var alternative = getValue("alternative");
+ var paired = getValue("paired");
+ var svbSvrsltst = getValue("svb_Svrsltst");
+ var conflevel = getValue("conflevel");
+ var mu = getValue("mu");
+ var exact = getValue("exact");
+ var correct = getValue("correct");
+ var ties = getValue("ties");
+ var confintChecked = getValue("confint.checked");
+
+ // the R code to be evaluated
+ var confintChecked = getValue("confint.checked");
+ echo("\twcox.result <- ");
+ if(ties) {
+ echo("wilcox.exact(");
+ } else {
+ echo("wilcox.test(");
+ }
+ if(x) {
+ echo("\n\t\tx=" + x);
+ } else {}
+ if(y) {
+ echo(",\n\t\ty=" + y);
+ } else {}
+ if(alternative != "two.sided") {
+ echo(",\n\t\talternative=\"" + alternative + "\"");
+ } else {}
+ if(mu != 0) {
+ echo(",\n\t\tmu=" + mu);
+ } else {}
+ if(y && paired) {
+ echo(",\n\t\tpaired=TRUE");
+ } else {}
+ if(exact != "automatic") {
+ echo(",\n\t\texact=" + exact);
+ } else {}
+ if(correct) {
+ echo(",\n\t\tcorrect=TRUE");
+ } else {}
+ if(confintChecked) {
+ echo(",\n\t\tconf.int=TRUE");
+ if(conflevel != 0.95) {
+ echo(",\n\t\tconf.level=" + conflevel);
+ } else {}
+ } else {}
+ echo("\n\t)\n\n");
+}
+
+function printout(){
+ // printout the results
+
+
+ var confintChecked = getValue("confint.checked");
+ var correct = getValue("correct");
+ var exact = getValue("exact");
+ var paired = getValue("paired");
+ var mu = getValue("mu");
+ echo("rk.header (wcox.result$method,\n" + "\tparameters=list (\"Comparing\", paste (names, collapse=\" against \"),\n" + "\t\"H1\", rk.describe.alternative (wcox.result),\n" + "\t\"Continuity correction in normal approximation for p-value\", ");
+ if(correct) {
+ echo("\"TRUE\",\n");
+ } else {
+ echo("\"FALSE\",\n");
+ }
+ echo("\t\"Compute exact p-value\", \"" + exact + "\",\n");
+ echo("\t\"Paired test\", ");
+ if(paired) {
+ echo("\"TRUE\",\n");
+ } else {
+ echo("\"FALSE\",\n");
+ }
+ echo("\t\"mu\", \"" + mu + "\"))\n\n");
+ echo("rk.results (list (\n" + "\t\"Variable Names\"=names,\n" + "\t\"Statistic\"=wcox.result$statistic,\n" + "\t\"Location Shift\"=wcox.result$null.value,\n" + "\t\"Hypothesis\"=wcox.result$alternative,\n" + "\tp=wcox.result$p.value");
+ if(confintChecked) {
+ echo(",\n\t\"Confidence interval percent\"=(100 * attr(wcox.result$conf.int, \"conf.level\")),\n" + "\t\"Confidence interval of difference\"=wcox.result$conf.int,\n" + "\t\"Difference in Location\"=wcox.result$estimate");
+ } else {}
+ echo("))\n");
+ //// save result object
+ // read in saveobject variables
+ var svbSvrsltst = getValue("svb_Svrsltst");
+ var svbSvrsltstActive = getValue("svb_Svrsltst.active");
+ var svbSvrsltstParent = getValue("svb_Svrsltst.parent");
+ // assign object to chosen environment
+ if(svbSvrsltstActive) {
+ echo("assign(\"" + svbSvrsltst + "\", wcox.result, envir=" + svbSvrsltstParent + ")\n");
+ } else {}
+
+}
+
Added: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.rkh (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.rkh 2011-12-16 19:43:13 UTC (rev 4132)
@@ -0,0 +1,32 @@
+<!DOCTYPE rkhelp>
+<document>
+ <summary>
+ This test performs the Wilcoxon Rank Sum and Signed Rank Tests (the first is equivalent to the Mann-Whitney test).
+ </summary>
+
+ <usage>
+ Select a single vector (or paired test) to perform a Wilcoxon signed rank test on the null that the true distribution of x (or the difference between the paired vectors) is symmetric about 0 (or the specified location).
+
+ Select two vectors to perform a Wilcoxon rank sum test (equivalent to the Mann-Whitney test: see <link href="rkward://rhelp/wilcox.test"/> for details) on the null that the distributions of x and y differ (by 0 or the specified location shift).
+ </usage>
+
+ <settings>
+ <caption id="tab_variables"/>
+ <setting id="x">Select the data to be computed. The vectors need to be numeric.</setting>
+ <setting id="alternative">The alternative hypothesis. "greater" means that x is shifted to the right of y / of the location parameter.</setting>
+ <setting id="paired">Check this for a paired test (Wilcoxon signed rank test of the difference between the two vectors).</setting>
+ <caption id="tab_options"/>
+ <setting id="confint">Check this if you want the confidence interval to be computed/printed.</setting>
+ <setting id="conflevel">Confidence level of the printed confidence interval.</setting>
+ <setting id="mu">The location / location shift to form the null hypothesis.</setting>
+ <setting id="exact">Should an exact p-value be computed? By default ("Automatic") an asymptomatic p-value is calculated if and only if you have less than 50 cases per group without binding than an exact test should be performed.</setting>
+ <setting id="ties">Check this option to compute an exact p-value even in the presence of ties.</setting>
+ <setting id="correct">If checked a continuity correction in the normal approximation for the p-value is applied.</setting>
+ </settings>
+ <related>
+ <ul>
+ <li><link href="rkward://rhelp/wilcox.test"/></li>
+ <li><link href="rkward://rhelp/wilcox.exact"/></li>
+ </ul>
+ </related>
+</document>
Added: trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.xml (rev 0)
+++ trunk/rkward/rkward/plugins/analysis/wilcoxon/wilcoxon_tests.xml 2011-12-16 19:43:13 UTC (rev 4132)
@@ -0,0 +1,51 @@
+<!DOCTYPE rkplugin >
+<document>
+ <code file="wilcoxon_tests.js" />
+ <help file="wilcoxon_tests.rkh" />
+ <logic>
+ <convert id="y_specified" sources="y.available" mode="notequals" />
+ <connect governor="y_specified" client="paired.enabled" />
+ </logic>
+ <dialog label="Wilcoxon/Mann-Whitney Test">
+ <tabbook id="auto">
+ <tab label="Basic settings" id="tab_variables">
+ <row id="row_vTFFPSSTFF">
+ <varselector id="vars" />
+ <column id="clm_vrslTFFPSS">
+ <varslot id="x" label="compare" source="vars" types="number" required="true" />
+ <varslot id="y" label="against (optional)" source="vars" types="number" />
+ <radio id="alternative" label="using test hypothesis">
+ <option label="Two-sided" value="two.sided" />
+ <option label="First is greater" value="greater" />
+ <option label="First is less" value="less" />
+ </radio>
+ <checkbox id="paired" label="Paired test" value="true" />
+ <stretch />
+ <saveobject label="Save results to workspace" checkable="true" initial="wcox.result" id="svb_Svrsltst" />
+ </column>
+ </row>
+ </tab>
+ <tab label="Options" id="tab_options">
+ <frame label="Compute confidence interval" checkable="true" id="confint">
+ <spinbox label="Confidence level" id="conflevel" initial="0.95" min="0" max="1" />
+ </frame>
+ <spinbox label="Location (shift) to test against (mu)" id="mu" />
+ <frame label="p-value options" id="frm_pvalptns">
+ <radio id="exact" label="Compute exact p-value">
+ <option label="Always" value="TRUE" />
+ <option label="Automatic" value="automatic" checked="true" />
+ <option label="Never" value="FALSE" />
+ </radio>
+ <row id="row_clmndcAAII">
+ <column id="clm_chckbxdcrA">
+ <checkbox id="correct" label="Apply continuity correction" value="correct" checked="true" />
+ </column>
+ <column id="clm_chckbxdtsI">
+ <checkbox id="ties" label="Allow ties" value="true" />
+ </column>
+ </row>
+ </frame>
+ </tab>
+ </tabbook>
+ </dialog>
+</document>
Modified: trunk/rkward/rkward/plugins/analysis.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/analysis.pluginmap 2011-12-16 16:01:24 UTC (rev 4131)
+++ trunk/rkward/rkward/plugins/analysis.pluginmap 2011-12-16 19:43:13 UTC (rev 4132)
@@ -7,6 +7,7 @@
<component type="standard" id="cor_graph" file="plots/cor_graph.xml" label="Correlation Matrix Plot" />
<component type="standard" id="descriptive" file="descriptive/descriptive_statistics.xml" label="Descriptive Statistics" />
<component type="standard" id="t_test" file="analysis/t_test.xml" label="t-Test" />
+ <component type="standard" id="wilcoxon_tests" file="analysis/wilcoxon/wilcoxon_tests.xml" label="Wilcoxon/Mann-Whitney Tests" />
<component type="standard" id="wilcoxon_test" file="analysis/wilcoxon/wilcoxon_test.xml" label="Wilcoxon Test" />
<component type="standard" id="wilcoxon_exact_test" file="analysis/wilcoxon/wilcoxon_exact_test.xml" label="Wilcoxon Exact Test" />
@@ -99,6 +100,7 @@
<entry component="PP_test"/>
</menu>
<menu id="wilcoxon_test" label="Wilcoxon Tests" index="11">
+ <entry component="wilcoxon_tests" />
<entry component="wilcoxon_test" />
<entry component="wilcoxon_exact_test" />
</menu>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list