Hello, When using bargraph.CI in package sciplot can the bars for each group be different colors? How do I select the color for each group? When I use this instead of the default (SD vs SE): bargraph.CI(x.factor = dose, response = len, data = ToothGrowth, ci.fun= function(x) c(mean(x)-sd(x), mean(x) + sd(x)) ) Am I getting 95% CI bars? Thank you kindly, Michael Just
On Nov 3, 2009, at 4:51 AM, Michael Just wrote:> Hello, > When using bargraph.CI in package sciplot can the bars for each group > be different colors?Yes. ?bargraph.CI> How do I select the color for each group?Read the help page. Fifth argument down.> > When I use this instead of the default (SD vs SE): > > bargraph.CI(x.factor = dose, response = len, data = ToothGrowth, > > ci.fun= function(x) c(mean(x)-sd(x), mean(x) + sd(x)) ) > > > Am I getting 95% CI bars?<Something> +/- one SD(<something> will almost never be a 95% CI. But this raises the question: CI bars for what parameter or statistic? (And raises the question: Have you read the help page entry regarding that parameter?) I do think it's good that you are considering plotting standard deviations rather than std errors of the mean, because the more common practice of plotting sem's obscures the degree of variability in the population. It's just that you appear to be aiming for what might be called a prediction interval and for it to be a 95% one, would need to be +/- 2 SD's. And if the numbers in each group are small, the "2" would get replaced with a t-statistic. If on the other hand you want to know what would be the right label for mean +/- sd, then given that +/- 1.96 SD would be a 95% prediction interval (for large samples) then you can see from > 1-2*pnorm(-1.96) [1] 0.9500042 > 1-2*pnorm(-1) [1] 0.6826895 ... that +/- one SD would be a 68% prediction interval.> > Thank you kindly, > Michael Just-- David Winsemius, MD Heritage Laboratories West Hartford, CT
On Tue, 2009-11-03 at 03:51 -0600, Michael Just wrote:> Hello, > When using bargraph.CI in package sciplot can the bars for each group > be different colors? How do I select the color for each group?With the option err.col bargraph.CI(dose, len, group = supp, data =ToothGrowth, err.col=c("gray","black"))> When I use this instead of the default (SD vs SE): > > bargraph.CI(x.factor = dose, response = len, data = ToothGrowth, > > ci.fun= function(x) c(mean(x)-sd(x), mean(x) + sd(x)) ) > > > Am I getting 95% CI bars?No. You're plotting +/- 1 SD.> > Thank you kindly, > Michael Just > > ______________________________________________ > R-help at 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.-- http://mutualism.williams.edu