7
function preprocess () {
11
echo ('names <- rk.get.description (' + x + ", " + y + ')\n');
14
function calculate () {
15
varequal = getValue ("varequal");
16
paired = getValue ("paired");
18
var conflevel = getValue ("conflevel");
19
var hypothesis = getValue ("hypothesis");
21
var options = ", alternative=\"" + hypothesis + "\"";
22
if (paired) options += ", paired=TRUE";
23
if ((!paired) && varequal) options += ", var.equal=TRUE";
24
if (conflevel != "0.95") options += ", conf.level=" + conflevel;
26
echo ('result <- t.test (' + x + ", " + y + options + ')\n');
29
function printout () {
30
echo ('rk.header (result$method, \n');
31
echo (' parameters=list ("Comparing", paste (names[1], "against", names[2]),\n');
32
echo (' "H1", rk.describe.alternative (result)');
35
echo (' "Equal variances", "');
36
if (!varequal) echo ("not");
41
echo ('rk.results (list (\n');
42
echo (' \'Variable Name\'=names,\n');
43
echo (' \'estimated mean\'=result$estimate,\n');
44
echo (' \'degrees of freedom\'=result$parameter,\n');
45
echo (' t=result$statistic,\n');
46
echo (' p=result$p.value');
47
if (getValue ("confint")) {
49
echo (' \'confidence interval percent\'=(100 * attr(result$conf.int, "conf.level")),\n');
50
echo (' \'confidence interval of difference\'=result$conf.int ');