[rkward-cvs] SF.net SVN: rkward:[4114] trunk/rkward/rkward/plugins/analysis
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue Dec 13 10:31:15 UTC 2011
Revision: 4114
http://rkward.svn.sourceforge.net/rkward/?rev=4114&view=rev
Author: tfry
Date: 2011-12-13 10:31:15 +0000 (Tue, 13 Dec 2011)
Log Message:
-----------
Reorganize t-test plugin some more.
Modified Paths:
--------------
trunk/rkward/rkward/plugins/analysis/t_test.js
trunk/rkward/rkward/plugins/analysis/t_test.rkh
trunk/rkward/rkward/plugins/analysis/t_test.xml
Modified: trunk/rkward/rkward/plugins/analysis/t_test.js
===================================================================
--- trunk/rkward/rkward/plugins/analysis/t_test.js 2011-12-13 09:01:39 UTC (rev 4113)
+++ trunk/rkward/rkward/plugins/analysis/t_test.js 2011-12-13 10:31:15 UTC (rev 4114)
@@ -4,7 +4,7 @@
var mu;
var testForm;
var varequal;
-var paired;
+var confint;
function preprocess () {
x = getValue ("x");
@@ -12,7 +12,7 @@
mu = getValue ("mu");
testForm = getValue ("test_form");
- if (testForm == "vars") {
+ if (testForm != "const") {
echo ('names <- rk.get.description (' + x + ", " + y + ')\n');
} else {
echo ('names <- rk.get.description (' + x + ')\n');
@@ -21,18 +21,18 @@
function calculate () {
varequal = getValue ("varequal");
- paired = getValue ("paired");
+ confint = getValue ("confint");
var conflevel = getValue ("conflevel");
var hypothesis = getValue ("hypothesis");
var options = ", alternative=\"" + hypothesis + "\"";
- if (testForm == "vars" && paired) options += ", paired=TRUE";
- if (testForm == "vars" && (!paired) && varequal) options += ", var.equal=TRUE";
- if (conflevel != "0.95") options += ", conf.level=" + conflevel;
+ if (testForm == "paired") options += ", paired=TRUE";
+ else if (testForm == "indep" && varequal) options += ", var.equal=TRUE";
+ if (confint && (conflevel != "0.95")) options += ", conf.level=" + conflevel;
echo('result <- t.test (x=' + x);
- if(testForm == "vars") {
+ if(testForm != "const") {
echo(', y=' + y);
} else {
echo(', mu=' + mu);
@@ -42,15 +42,15 @@
function printout () {
echo ('rk.header (result$method, \n');
- if (testForm == "vars") {
- echo (' parameters=list ("Comparing", paste (names[1], "against", names[2]),\n');
+ if (testForm != "const") {
+ echo (' parameters=list ("Comparing"=paste (names[1], "against", names[2]),\n');
} else {
- echo (' parameters=list ("Comparing", paste (names[1], "against constant"),\n');
+ echo (' parameters=list ("Comparing"=paste (names[1], "against constant"),\n');
}
- echo (' "H1", rk.describe.alternative (result)');
- if (!paired) {
+ echo (' "H1"=rk.describe.alternative (result)');
+ if (testForm == "indep") {
echo (',\n');
- echo (' "Equal variances", "');
+ echo (' "Equal variances"="');
if (!varequal) echo ("not");
echo (' assumed"');
}
@@ -62,7 +62,7 @@
echo (' \'degrees of freedom\'=result$parameter,\n');
echo (' t=result$statistic,\n');
echo (' p=result$p.value');
- if (getValue ("confint")) {
+ if (confint) {
echo (',\n');
echo (' \'confidence interval percent\'=(100 * attr(result$conf.int, "conf.level")),\n');
echo (' \'confidence interval of difference\'=result$conf.int ');
Modified: trunk/rkward/rkward/plugins/analysis/t_test.rkh
===================================================================
--- trunk/rkward/rkward/plugins/analysis/t_test.rkh 2011-12-13 09:01:39 UTC (rev 4113)
+++ trunk/rkward/rkward/plugins/analysis/t_test.rkh 2011-12-13 10:31:15 UTC (rev 4114)
@@ -10,16 +10,15 @@
<settings>
<caption id="tab_variables"/>
- <setting id="test_form">Chose if you want a two samples test, or test against a constant</setting>
+ <setting id="test_form">Chose whether you want a two samples test (paired samples or independent samples), or to test a single variable against a constant</setting>
<setting id="x">A numeric vector for the first variable</setting>
<setting id="y">A numeric vector for the second variable. Available for two samples tests only.</setting>
<setting id="mu">A numeric constant. Available for tests agains constant only.</setting>
+ <setting id="varequal">Whether to assume equal variances for the two samples (for independent samples t-test, only). This option is implied for a paired test.</setting>
<setting id="hypothesis">Alternative hypothesis (H1) of the test.</setting>
- <setting id="paired">Whether the variables are paired (repeated measurements on the same subject) or independent samples. For a paired test, if the two vectors are not of equal length, there will be an error.</setting>
<caption id="tab_options"/>
- <setting id="varequal">Whether to assume equal variances for the two samples. This option is implied for a paired test.</setting>
- <setting id="conflevel">Confidence level to use.</setting>
<setting id="confint">Whether to print the confidence interval of the estimated mean.</setting>
+ <setting id="conflevel">Confidence level to print.</setting>
</settings>
<related>
<ul>
Modified: trunk/rkward/rkward/plugins/analysis/t_test.xml
===================================================================
--- trunk/rkward/rkward/plugins/analysis/t_test.xml 2011-12-13 09:01:39 UTC (rev 4113)
+++ trunk/rkward/rkward/plugins/analysis/t_test.xml 2011-12-13 10:31:15 UTC (rev 4114)
@@ -4,45 +4,43 @@
<help file="t_test.rkh"/>
<logic>
- <convert id="two_vars" sources="test_form.string" mode="equals" standard="vars" />
- <connect governor="two_vars" client="y.visible" />
- <connect governor="two_vars" client="y.required" />
- <connect governor="two_vars.not" client="mu.visible" />
- <connect governor="two_vars" client="paired.enabled" />
- <connect governor="two_vars" client="varequal.enabled" />
- <convert id="notpaired" sources="paired.state" mode="equals" standard="0" />
- <connect governor="notpaired" client="varequal.enabled" />
- <convert id="noteqvars" sources="varequal.state" mode="equals" standard="0" />
- <connect governor="noteqvars" client="paired.enabled" />
+ <convert id="indep_samples" sources="test_form.string" mode="equals" standard="indep" />
+ <convert id="single_sample" sources="test_form.string" mode="equals" standard="const" />
+ <connect governor="single_sample.not" client="y.visible" />
+ <connect governor="indep_samples" client="varequal.visible" />
+ <connect governor="single_sample" client="mu.visible" />
</logic>
<dialog label="t-Test">
<tabbook>
<tab label="Basic settings" id="tab_variables">
+ <row>
+ <stretch/>
+ <dropdown id="test_form" label="Test form">
+ <option label="Independent samples" value="indep" checked="true" />
+ <option label="Paired samples" value="paired" />
+ <option label="Single sample (test against constant)" value="const" />
+ </dropdown>
+ <stretch/>
+ </row>
<row id="basic_settings_row">
<varselector id="vars"/>
<column>
- <dropdown id="test_form" label="Test form">
- <option label="compare two variables" value="vars" checked="true" />
- <option label="compare variable against constant" value="const" />
- </dropdown>
<varslot id="x" label="compare" source="vars" types="number" required="true" />
- <varslot id="y" label="against" source="vars" types="number" />
+ <varslot id="y" label="against" source="vars" types="number" required="true" />
+ <checkbox id="varequal" label="assume equal variances" value="1" value_unchecked="0"/>
<spinbox label="against" id="mu" initial="0" />
<radio id="hypothesis" label="using test hypothesis">
<option value="two.sided" label="Two-sided"/>
<option value="greater" label="First is greater"/>
<option value="less" label="Second is greater"/>
</radio>
- <checkbox id="paired" label="Paired sample" value="1" value_unchecked="0" />
</column>
</row>
</tab>
<tab label="Options" id="tab_options">
- <checkbox id="varequal" label="assume equal variances" value="1" value_unchecked="0"/>
- <frame label="Confidence Interval" id="confint_frame">
+ <frame label="Show Confidence Interval" id="confint" checkable="true" checked="true">
<spinbox type="real" id="conflevel" label="confidence level" min="0" max="1" initial="0.95"/>
- <checkbox id="confint" label="print confidence interval" value="1" checked="true"/>
</frame>
<stretch/>
</tab>
@@ -51,23 +49,21 @@
<wizard label="Two Variable t-Test">
<page>
<text>
- As a first step, chose if you want to compare two variable mean or one variable mean against
- a constant value. Then select the variables/values you want to compare against each other.
- And specify, which one you theorize to be greater. Select two-sided, if your theory does not tell you,
- which variable is greater.</text>
- <copy id="basic_settings_row"/>
+ As a first step, select the type of test to conduct. Select "Independent samples" when comparing data
+ from two different populations (e.g. treatment group vs. control group). For comparing matched pairs
+ or repeated measures on the same subject, select "Paired samples". Finally, you can also test a
+ single sample against a constant value.</text>
+ <copy id="test_form"/>
</page>
<page>
<text>
- Below are some advanced options. It's generally safe not to assume the variables have equal variances.
- An appropriate correction will be applied then. Chosing "assume equal variances" may increase
- test power, however.</text>
- <copy id="varequal"/>
+ Select the parameters of the t-test. If your hypothesis is directed, selecting a directional test hypothesis may increase test power.</text>
+ <copy id="basic_settings_row"/>
<text>
Sometimes it's helpful to get an estimate of the confidence interval of the difference in means.
Below you can specify whether one should be shown, and which confidence-level should be applied
(95% corresponds to a 5% level of significance).</text>
- <copy id="confint_frame"/>
+ <copy id="confint"/>
<stretch/>
</page>
</wizard>
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