I would like to know if you have any suggestions how to visualize the
results from a paired t-test (see the example data below). I tried to
produce plots that show the mean and CI's from the original data and the
estimate of the difference between means and the confidence intervals (see
below) from the t-test. I really don't know what would be the best way to
graphically display the results. Thanks in advance.
#### data ######
sam1 <- c(51.7, 54.2, 53.3, 57, 56.4, 61.5, 57.2, 56.2, 58.4, 55.8)
sam2 <- c(62.5, 65.2, 67.6, 69.9, 69.4, 70.1, 67.8, 67, 68.5, 62.4)
DF <- stack(data.frame(sam1 = sam1, sam2 = sam2))

#### paired-t-test ######

res <- t.test(values ~ ind, data=DF, paired = TRUE)

#### plots #####
library(gregmisc)

opar <- par(mfrow=c(1,2))
tapply(DF$values, list(DF$ind), ci)
plotmeans(values ~ ind, data=DF)

d <- sam1 - sam2
stripchart(d, vertical=T, pch=16)
points(1, res$estimate, col="red", pch=16)
arrows(1, res$estimate, 1, res$conf.int[1], col="red", lwd=2, angle=90,
length=0.1)
arrows(1, res$estimate, 1, res$conf.int[2], col="red", lwd=2, angle=90,
length=0.1)

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to