Re: [R] s.e. on interaction plots

2006-11-17 Thread Chuck Cleland
Murray Pung wrote:
 Is it possible to add standard error bars to the means on interaction plots?

  Not with interaction.plot(), as far as I know.  You might consider the
effects package by John Fox.  For example:

with(ToothGrowth, interaction.plot(dose, supp, len))

ToothGrowth$dose - as.factor(ToothGrowth$dose)

TG.lm - lm(len ~ supp * dose, data = ToothGrowth)

library(effects) # loads lattice and grid packages

plot(effect(supp:dose, TG.lm))

  You also could construct your own plot using the standard errors
produced by effect():

sum.df - data.frame(len = effect(supp:dose, TG.lm)$fit,
 se = effect(supp:dose, TG.lm)$se,
 supp = rep(c(OJ, VC), 3),
 dose = rep(c(.5,1,2), each = 2))

library(Hmisc)

xYplot(Cbind(len, len - se, len + se) ~ dose | supp, data=sum.df,
   type=b, ylim=c(0,30))

xYplot(Cbind(len, len - se, len + se) ~ dose, groups=supp, data=sum.df,
   type=b, ylim=c(0,30))

 Thanks
 Murray

-- 
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

__
R-help@stat.math.ethz.ch 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.


Re: [R] s.e. on interaction plots

2006-11-17 Thread Manuel Morales
On Fri, 2006-11-17 at 05:21 -0500, Chuck Cleland wrote:
 Murray Pung wrote:
  Is it possible to add standard error bars to the means on interaction plots?
 
   Not with interaction.plot(), as far as I know.  You might consider the
 effects package by John Fox.  For example:

Another possibility is the function lineplot.CI from the package sciplot
(a wrapper that adds SE bars to the output from interaction plots). For
example:

library(sciplot)
data(ToothGrowth)
lineplot.CI(dose, len, group = supp, data = ToothGrowth)


-- 
Manuel A. Morales
http://mutualism.williams.edu
__
R-help@stat.math.ethz.ch 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.