- using chi-square test
- d-separation
T-test with Perl
#! /usr/bin/perl
use Statistics::TTest;
use Statistics::Basic qw(:all);
my @Data1 = qw(1 2 3 4);
my @Data2 = qw(11 12 13 11 16);
my $mean = mean( @Data1 ) ;
print $mean;
my $ttest = new Statistics::TTest;
$ttest->set_significance(95);
$ttest->load_data(\@Data1,\@Data2);
#$ttest->output_t_test();
my $t = $ttest->t_statistic;
my $df = $ttest->df;
my $prob = $ttest->{t_prob};
my $test = $ttest->null_hypothesis();
print "t=$t (df = $df) - p-value = $prob\nNull hypothesis is $test\n";
T-test with R (paired)
args <- commandArgs(TRUE) data1 <- args[1] # data file / numeric vector data2 <- args[2] # data file / numeric vector v1 <- read.table( file=data1, header=F ) v1 <- as.vector( v1 ) v2 <- read.table( file=data2, header=F ) v2 <- as.vector( v2 ) t.test( v1, v2, paired=F )
One-way ANOVA
http://www.math.mcmaster.ca/peter/s2ma3/s2ma3_0102/classnotes/notes20020328.html
Tuekey TEst
http://www.agr.kuleuven.ac.be/vakken/statisticsbyR/ANOVAbyRr/multiplecomp.htm
require(graphics)
#summary(fm1 = aov(breaks ~ wool + tension, data = warpbreaks))
#TukeyHSD(fm1, "tension", ordered = TRUE)
c2 = read.table(file="c2.txt", header=T)
fm2 = aov( score ~ group, data=c2)
TukeyHSD(fm2, "group", ordered = TRUE)
plot(TukeyHSD(fm2, "group"))
c4 = read.table(file="c4.txt", header=T)
fm4 = aov( score ~ group, data=c4)
TukeyHSD(fm4, "group", ordered = TRUE)
plot(TukeyHSD(fm4, "group"))
g1 g2 g3 g4
-------------------
1 2 3 2
2 3 1 2
-------------------
g = read.csv( "g-ratio.csv", sep="\t" )
d = read.csv( "diameter.csv", sep="\t" )
g1 = as.vector( g[,1] )
g1 = g1[ g1 != "" ][-1]
g2 = as.vector( g[,2] )
g2 = g2[ g2 != "" ][-1]
g3 = as.vector( g[,3] )
g3 = g3[ g3 != "" ][-1]
g4 = as.vector( g[,4] )
g4 = g4[ g4 != "" ][-1]
group = c( rep("g1", length(g1)), rep("g2", length(g2)), rep("g3", length(g3)), rep("g4", length(g4)) )
score = as.numeric( c( g1, g2, g3, g4 ) )
t = data.frame( group )
t$score = score
fm = aov( score ~ group, data=t)
TukeyHSD(fm, "group", ordered = TRUE)
plot(TukeyHSD(fm, "group"))