You may want to look at the interaction function (a quick way to make the 
single factor with 4 levels that you mention).

You can create your own sets of contrasts and set them using the C or contrasts 
functions, then use the split argument to summary.aov to look at the individual 
degrees of freedom.

You may also be interested in the multcomp package for looking at the 
comparisons.

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
[EMAIL PROTECTED]
(801) 408-8111
 
 

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Ronaldo Reis Junior
> Sent: Monday, July 23, 2007 4:05 PM
> To: R-Help
> Subject: [R] Function to separate effect in AOV
> 
> Hi,
> 
> I have a dummy question.
> 
> Suppose that I have two explanatory variable, T1 (A, B) and 
> T2 (C, D) and one response variable.
> 
> > attach(dados)
> 
> > tapply(Y,list(T1,T2),mean)
>          C        D
> A 2.200000 10.20000
> B 2.223333 20.26667
> 
> In this case, "A" and "B" inside "C" have no difference, but 
> have differences inside "D"
> 
> I make this model:
> 
> > m <- aov(Y~T1*T2)
> > 
> > summary(m)
>             Df Sum Sq Mean Sq F value    Pr(>F)    
> T1           1  76.36   76.36  5617.9 1.119e-12 ***
> T2           1 508.69  508.69 37426.7 5.704e-16 ***
> T1:T2        1  75.65   75.65  5566.0 1.161e-12 ***
> Residuals    8   0.11    0.01                      
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
> 
> 
> This result don't show the reality of the data, because I 
> cant see that "A" 
> and "B" inside "C" are the same.
> 
> The anova result is the same of an full different levels, like this:
> 
> > attach(dados2)
> > 
> > tapply(Y,list(T1,T2),mean)
>          C        D
> A 6.100000 10.20000
> B 2.223333 20.26667
> > 
> > m <- aov(Y~T1*T2)
> > 
> > summary(m)
>             Df Sum Sq Mean Sq F value    Pr(>F)    
> T1           1  28.74   28.74  2114.3 5.529e-11 ***
> T2           1 367.75  367.75 27056.7 2.088e-15 ***
> T1:T2        1 145.81  145.81 10728.1 8.433e-14 ***
> Residuals    8   0.11    0.01                      
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
> 
> In this case all level are different, C to D and A to B.
> 
> The question is:
> 
> The only way to find this real difference is:
> 
> 1) make T1 and T2 like a Treatment variable with 4 levels 
> (AC,BC,AD,BD)?
> 
> or
> 
> 2) make 3 anova:
>       a) Anova (A,B) inside C
>       b) Anova (A,B) inside D
>       c) Full factorial Anova (like this in the e-mail)
> 
> or
> 
> 3) exist any other way to make this in only one analysis, to 
> find all differences e interactions? In other words, to find 
> differences in "A" 
> and "B" inside "C", "A" and "B" inside "D", "C" and "D" 
> inside "A" and "C" 
> and "D" inside "B" 
> 
> Thanks
> Ronaldo
> --
> > Prof. Ronaldo Reis Júnior
> |  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia
> | : :'  : Campus Universitário Prof. Darcy Ribeiro, Vila Mauricéia `. 
> | `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
> |   `- Fone: (38) 3229-8187 | [EMAIL PROTECTED] | 
> | [EMAIL PROTECTED] http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | 
> | LinuxUser#: 205366
> 
> ______________________________________________
> [email protected] 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.
>

______________________________________________
[email protected] 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