Re: [R] add confidence intervales to xyplot for ANCOVA and extracting info

From: Deepayan Sarkar <deepayan.sarkar_at_gmail.com>
Date: Mon 02 Apr 2007 - 19:07:26 GMT

On 3/31/07, Patrick Drechsler <patrick@pdrechsler.de> wrote:
> Hi,
>
> I would like to add confidence intervales to an ANCOVA with 2
> covariates when using xyplot.
>
> What would be a good way of accomplishing this?

demo("intervals", package = "lattice")

will give you examples of confidence intervals. If you want more specific answers, please give a more relevant example.

> --8<---------------cut here---------------start------------->8---
> rm(list = ls(all = TRUE))
> rm(list = c(ls()))
>
> library(lattice)
>
> ## 1. generate data
> random <- rnorm(200)
> y <- abs(random)
> x1.cont <- abs(random)
> x2.fac <- as.factor(rep(1:5, 4)) # 4 groups
> x3.fac <- as.factor(rep(1:4, each=5))# 5 groups
> A <- data.frame(y, x1.cont, x2.fac, x2.fac)
>
> ## 2. plot data
> foo <- xyplot(log(y) ~ log(x1.cont) | x2.fac * x3.fac,
> data = A,
> type = c("p","r"),
> strip = strip.custom(strip.names=TRUE),
> as.table=TRUE)
>
> plot(foo)
> --8<---------------cut here---------------end--------------->8---
>
> The function xyplot calculates many statistics so it can produce
> regression lines and other things using "type".

No it doesn't. The regression line is draw by panel.lmline, which is called by panel.xyplot, and that is executed in the plot(foo) stage. In other words, foo does not contain the results of those calculations.

-Deepayan

> How does one access
> this data for further analysis? I have looked at str(foo), but I did
> not see an easy way of extracting the data.
>
> TIA,
>
> Patrick
>
> ,----[ sessionInfo() ]
> | R version 2.4.1 (2006-12-18)
> | i486-pc-linux-gnu
> |
> | locale:
> | LC_CTYPE=de_DE.UTF-8;LC_NUMERIC=C;LC_TIME=de_DE.UTF-8;LC_COLLATE=de_DE.UTF-8;LC_MONETARY=de_DE.UTF-8;LC_MESSAGES=de_DE.UTF-8;LC_PAPER=de_DE.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=de_DE.UTF-8;LC_IDENTIFICATION=C
> |
> | attached base packages:
> | [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods"
> | [7] "base"
> |
> | other attached packages:
> | lattice
> | "0.14-17"
> `----
>
> --
> Patrick Drechsler
> Department of Zoology
> University of Cambridge
> Downing Street
> Cambridge CB2 3EJ, UK
>
> ______________________________________________
> 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.
>



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. Received on Tue Apr 03 05:13:33 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 02 Apr 2007 - 20:32:08 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.