Keywords - Function groups - @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Library: stats
See also: anova

Quantlet: ttest
Description: runs a t-test

Reference(s):

Usage: tout=ttest(d1,d2)
Input:
d1 n1 x 1 vector, one-dimensional data sample
d2 n2 x 1 vector or scalar, one-dimensional data sample or a scalar
Output:
tout vector of strings, text output

Note:

Example:
library("stats")
x=read("allbus.dat")
man=paf(x,x[,1]==1)[,2]
woman=paf(x,x[,1]==2)[,2]
ttest(man,woman)

Result:
[1,] " -------- t-test (For equality of Means) -------- "
[2,] "-------------------------------------------------"
[3,] "               t-value    d.f.     Sig.2-tailed "
[4,] "Equal var.:     13.8703    714       0.0000"
[5,] "Uneq. var.:     15.6322    713.01    0.0000"
Example:
library("stats")
x=read("allbus.dat")
man=paf(x,x[,1]==1)[,2]
ttest(man,2300)

Result:
[1,] " ------------- t-test (one sample) ------------- "
[2,] "-------------------------------------------------"
[3,] "               t-value    d.f.     Sig.2-tailed "
[4,] "        :     -0.2324    450       0.8163"
Example:
library("stats")
x=read("allbus.dat")
man=paf(x,x[,1]==1)[,2]
man1=man[1:100,]
man2=man[101:200,]
ttest(man1,man2)

Result:
[1,] " ---------- t-test (pairwise t test) ----------- "
[2,] "-------------------------------------------------"
[3,] "               t-value    d.f.     Sig.2-tailed "
[4,] "        :     10.1449     99       0.0000"



Author: M.Benko 20030428 license MD*Tech
(C) MD*TECH Method and Data Technologies, 05.02.2006