[R] doubly multivariate analysis in R

Jonathan Baron baron at psych.upenn.edu
Mon Jul 5 02:55:57 CEST 2004


On 07/04/04 16:06, Ludo Max wrote:
>
>20 subjects were measured in 5 conditions (thus repeated measures) and
>for each subject in each condition there are 4 response measures (thus
>multivariate as it is a combined score that needs to be compared across
>the conditions).
>
>So, using a multivariate approach to repeated measures this is a doubly
>multivariate analysis.
>
>I would appreciate any suggestions as to the best way to do such a
>doubly multivariate analysis in R (I have done it in SPSS and SAS but
>would like to see what it takes to do the same in R).

This is the format of most of what I do.  You might find it
useful to look at our "Notes on R for psychology...", reachable
through the R page in my signature.

But the real answer depends heavily on what you want to find out.
I use the same basic format for most of what I do - experiments
on the Web using Javascript to generate items and questions - but
the data analysis varies greatly from study to study, so the
format does not determine the analysis.

I do put all my analysis scripts and experiments in my web page
under "Public archives...."  If you go back and forth between the
experiments and the R scripts, you can even get some idea of the
relation between the two, although probably not much.  (Also,
some of these are pretty old and I've found much better ways to
do things in both R and JavaScript.)  At least you might find
these helpful for getting started.

Now, I usually use an array with the dimensions: subjects,
conditions, and questions.  A lot of what I do involves
calculating within-subject correlations and regressions.  I used
to do that entirely with loops, but lately I've found that R's
mapply() function can do some of it, as well as apply().

Jon
-- 
Jonathan Baron, Professor of Psychology, University of Pennsylvania
Home page:            http://www.sas.upenn.edu/~baron
R search page:        http://finzi.psych.upenn.edu/




More information about the R-help mailing list