On Sun, Jul 18, 2010 at 6:44 PM, jlwoodard <john.wood...@wayne.edu> wrote: > > Hi Phil and Jeff, > Thanks so much for taking the time to help me solve this issue! Both > approaches work perfectly. Each of your approaches helped me learn more > about what R can do. I really appreciate your help!
Hi John, Now that you've seen some of R's fancy data manipulation footwork, here's a small taste of the graphing capabilties (the matching of colors and glyphs with your factor levels is serendipitous :-)) dat <- structure(list(Accuracy = c(95L, 80L, 100L, 90L, 100L, 100L, 95L, 85L, 100L, 90L, 100L, 100L, 60L, 55L, 80L, 45L, 75L, 45L ), Subject = structure(c(1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L), .Label = c("subj101", "subj102" ), class = "factor"), Shape = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("Circle", "Triangle", "Square"), class = "factor"), Color = structure(c(3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L, 3L, 3L, 1L, 1L, 2L, 2L), .Label = c("Red", "Green", "Blue"), class = "factor")), .Names = c("Accuracy", "Subject", "Shape", "Color"), row.names = c(NA, -18L), class = "data.frame") library(ggplot2) X11(12, 6) qplot(Shape:Color, Accuracy, data = dat, colour = Color, shape = Shape, facets = . ~ Subject) Suggesting (keeping in mind here we have a sample of just 2 subjects): i) lower accuracy for triangles ii) lower accuracy for blue (subj102 triangls is an exception) iii) the upper bound on accuracy is often reached. iv) the upper bound may mask effects. For example look at the color effects for circles and squares -- for subj101 the green effect might be masked by the upper bound. v) there is Color:Shape interaction (e.g. the color effects differ for triangles) vi) there is likely between-subject variation in the mean and possibly in effects as well. As for analyses, my preference for repeated measures is to use likelihood-based rather than sums-of-squares based methods. Usually I'd recommend lme4::lmer OR nlme:lme starting with random Subject intercepts (appears to really just be a RCBD, so a start might be lmer(Accuracy ~ Shape*Color + (1|Subject), dat)), but the constrained response and limited sample size (both terms of number of subjects and conflation between error and interaction) makes me think fitting a meaningful model is not trivial. Off the cuff, perhaps a beta or binomial model or using logit-transformed Accuracy (noting that nothing can retrieve the 'theoretical effects' mentioned in (iv) above, but that may not be of interest), best, Kingsford Jones > > Very best regards, > > John > -- > View this message in context: > http://r.789695.n4.nabble.com/Help-with-Reshaping-from-Wide-to-Long-tp2292462p2293463.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > ______________________________________________ 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.