Hi Paul,

Let me ask you one question - when you say "tank" does it indicate some kind of 
chamber or area in which all the 9 pairs are tested / treated / observed? If so 
- then each of the tanks would constitute a sort of block or a homogeneous 
group. Your data would look like this:

Obs    Tank    Male_type    Female_type    Response
1    1    1    1    43
2    2    1    1    52
3    3    1    1    48
4    4    1    1    58
5    5    1    1    55
6    1    1    2    52
7    2    1    2    58
8    3    1    2    46
9    4    1    2    51
10    5    1    2    54
11    1    1    3    40
12    2    1    3    49
13    3    1    3    57
14    4    1    3    49
15    5    1    3    40
…    …    …    …    …

The only reason you would code it in the above way is if you believe there is 
some kind of effect of tank on the outcome.
Then you can add the block effect / tank effect in your model and test its 
significance in a 3 - way ANOVA design.

Your initial model will be:

model1 <- lm(y ~ male + female + tank + male:female, data = dataset)

If the model says - your "tank" effect is not significant you can remove the 
term and look at the reduced form of the model:

model2 <- lm(y ~ male + female + male:female, data = dataset)

Let me know if this is making sense to you.

Regards,
Indrajit


________________________________
From: Austin Paul <austi...@usc.edu>

Cc: "r-help@r-project.org" <r-help@r-project.org>
Sent: Tuesday, September 27, 2011 12:30 PM
Subject: Re: [R] two-way anova help


Hi Indrajit and Bert,
 
I really appeciate your help.  I have coded as you mentioned, but I feel like 
I am losing a lot of data because I am not accounting for the replicate tanks 
(what if the 5 replicates of the same cross type vary more among tanks than 
within?).  Below is what my data would look like (if it comes through)
 
obs  male female rep response 
1 1 1 1 34 
2 1 1 1 44 
. . . . . 
. . . . . 
51 1 1 2 37 
. . . . . 
. . . . . 
251 1 2 1 42 
 
So if I understand correctly, the five replicate tanks of each cross cannot be 
treated as technical replicates?  They are not exactly repeated measures in 
the sense they are different individuals in different replicate tanks.  If I 
pool all 250 observations for each cross, instead of treating it as 5x50 
observations, I feel like I am losing a lot of information.
 
Austin
  
 
On Mon, Sep 26, 2011 at 11:40 PM, Indrajit Sengupta <indra_cali...@yahoo.com> 
wrote:

Hi Paul,
>
>
>There should not be any problem. Here is how I visualize the data table looks 
>like:
>
>
>Obs Male_type   
> Female_type  
> Response 
>1 1 1 34 
>2 1 1 44 
>3 1 2 38 
>… … … … 
>If your data frame has the above structure, R will automatically understand 
>that there is replication. Your model form will remain the same.
>
>
>Regards,
>Indrajit
>
>
>
>________________________________
> From: Austin Paul <austi...@usc.edu>

>Cc: "r-help@r-project.org" <r-help@r-project.org>
>Sent: Tuesday, September 27, 2011 10:57 AM
>Subject: Re: [R] two-way anova help
> 
>
>
>Hi,
>
>Yes.  As I explained, the three male and three female types were crossed in 
>all combinations (9 ways).  For each of the 9 types, I have 5 replicate tanks 
>(45 total tanks).  And from each of the 45 tanks I have 50 observations for 
>size.  So the 5 replicates are somehow nested within the two-way 
>interaction?  If there was just 1 tank for each of the 9 crosses, yes, it 
>would be very easy to code the two-way anova.  It may still be very easy, but 
>I'm not quite sure how to account for the replicate tanks.  
>
>Hope this makes more sense. 
>
>Austin
>
>
>
>
>On Mon, Sep 26, 2011 at 10:21 PM, Indrajit Sengupta <indra_cali...@yahoo.com> 
>wrote:
>
>Can you explain what do you mean by "5 replicate tanks"?
>>
>>
>>Doing a two way anova is very simple in R. You would need to fit a linear 
>>model (lm function). 
>>
>>
>>
>>Eg.:
>>
>>
>>> model <- lm(y ~ male + female + male:female, data =)
>>
>>
>>
>>
>>Regards,
>>Indrajit
>>
>>
>>
>>
>>
>>________________________________
>> From: Austin Paul <austi...@usc.edu>
>>To: r-help@r-project.org
>>Sent: Tuesday, September 27, 2011 6:13 AM
>>Subject: [R] two-way anova help
>> 
>>
>>Hello,
>>
>>I am having some trouble coding a two-way anova due to replicated
>>treatments.
>>
>>I have a factorial design with three male parents and three female parents.
>>They were mated in all combinations and their babies were grown out and
>>measured for size.  50 babies were measured for each of the 9 crosses.  If I
>>stopped here, I would have no troubles.  But I also have 5 replicate tanks
>>for each of the 9 crosses.  My question is how to I code in the 5 replicate
>>tanks per treatment?
>>
>>Thanks,
>>Austin
>>
>>    [[alternative HTML version deleted]]
>>
>>______________________________________________
>>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.
>>
>>
>>
>
>
>
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to