Skip to content
Back to formatted view

Raw Message

Message-ID: <4B1035E3.3080904@biostat.ku.dk>
Date: 2009-11-27T20:26:11Z
From: Peter Dalgaard
Subject: using reshape to do ANOVA mixed models
In-Reply-To: <c5ce2cb0911271042k364bff3fid3f919986dd4c9f@mail.gmail.com>

Or Duek wrote:
> Hi,
> I just started with R and I found that there are many options to rearrange
> the data to do mixed models.
> I want to use the reshape function. I have 2 between subject variables and
> one within.
> I was able to change the data structure but still - the result of the aov
> functions are calculating everything as a within subject.
> the table looks like this:
> SerialNo    breed    treatment    distance_1   distance_2
> 1               c57       dfp             235              3253
> etc.
> 
> I changed it to look like this:
> SerialNo   breed   treatment    exposure   distance
> 1              c57     dfp               1              235
> 1              c57    dfp                2              3253
> etc.
> 
> Then I do:
> dt<-aov(distance~(exposure*treatment*breed)+Error(SerialNo/exposure) +
> (treatment*breed), dataframe)
> 
> what am I doing wrong?

For a start, not showing us the output.... Also not showing us enough of 
the data and not convincing us that you are actually using the reshaped 
data frame.


-- 
    O__  ---- Peter Dalgaard             ?ster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907