Hello johannes,
You're example looks nice and I am hoping to see more ideas from other
members.
Just one tiny idea:
In -
stripchart
Also use ylim to include the ZERO line (and then actually add the line) like
this:
plot.ylim <- c(min(d, 0), max(d, 0))
abline(h = 0, lty = 2, col = "blue", lwd =2)
stripchart(d, vertical=T, pch=16, ylim = plot.ylim )
This way you get to show how far you got the difference to be from the zero
(otherwise, all the graph gives is the variance, without any useful
knowledge of the distance of the differences from the zero)
Also, consider using this function for CI plotting:
http://finzi.psych.upenn.edu/R/library/plotrix/html/plotCI.html
Best,
Tal Galili
On Sat, Sep 12, 2009 at 12:00 PM, johannes rara
<johannesraja@gmail.com>wrote:
> 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.
>
--
----------------------------------------------
My contact information:
Tal Galili
Phone number: 972-50-3373767
FaceBook: Tal Galili
My Blogs:
http://www.r-statistics.com/
http://www.talgalili.com
http://www.biostatistics.co.il
[[alternative HTML version deleted]]