Skip to content

beginner's question: Graphical presentation of t test

1 message · Warnes, Gregory R

#
Take a look at the 'plotmeans' function in the gregmisc library.  It will
draw the means and error bars for you, allowing you to connect the means for
the paired control and treated groups with something like this:

<R code>
# sample source data 10 replicates for each enzyme for treated and control
x <- rnorm(60)
enzyme <- rep(c("ABC123", "ABD124", "CCF342"), length=60)
treat  <- rep(c("CONTROL","TREATED"), length=60)

# create a enzyme by treatment label
group <- interaction(enzyme, treat)

# plot the means and confidence intervals
library(gregmisc)
plotmeans( x ~ group, connect=list(1:2,3:4,5:6))

# add p-values
data <- data.frame(x, enzyme, treat)
p.vals <- by( data, enzyme, function(data) t.test( x ~ treat,
data=data)$p.value )
text(x=c(1.5, 3.5, 5.5), y=rep(0,3), paste("P-value:\n",
format.pval(p.vals)) )
</R code>
 
-Greg
LEGAL NOTICE\ Unless expressly stated otherwise, this message is... {{dropped}}