[R] ANOVA problem

robgriffin247 rg.rforum at hotmail.co.uk
Fri May 4 18:18:21 CEST 2012


Hi,
I need to create a data frame containing the results of a number of ANOVA's
but I'm having some trouble setting it up (some being enough for me to spend
3 days trying with no progress and be left staring in to the abyss which
some people call a weekend, and what I will call 2 quiet days in the
office...)

The response variable is *V*. 
I need to do an ANOVA for each *G*. 
The fixed effect will be *S* ("M" or "F") whilst also having the *S*L* and
*L* ("1" or "2") as random effects. 
The anova of *G* /AB01 /would be some thing like: y=V, fixed=S, Random= L &
L*S...
The new data frame would then compile all the variance components for each
G, including total and residual variance.

here is the example dataframe using 2 G's, with 2 S values, 2 L, and 2
replicates for each.

df<-as.data.frame(c("AB01","AB01","AB01","AB01","AB01","AB01","AB01","AB01","AB02","AB02","AB02","AB02","AB02","AB02","AB02","AB02"))
names(df)<-"G"
df$L<-as.numeric(c(1,1,1,1,2,2,2,2,1,1,1,1,2,2,2,2))
df$S<-(c("m","m","f","f","m","m","f","f","m","m","f","f","m","m","f","f"))
df$R<-as.numeric(c(1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2))
df$V<-as.numeric(c(1,2,12,21,5,6,12,34,1,6,52,41,5,43,13,24))

It is worth noting the actual data this will be used on is >10000*G's, 
2*S's,  40*L's,  and 2*R's so hand writing an ANOVA for each G is not
preferred...

Here is a twitter link to a crudely drawn illustration of the aim
illustrated (using 3 Ls) in case I have confused you with words (through my
own poor understanding): 
https://twitter.com/#!/robgriffin247/status/198446041316593666/photo/1/large
https://twitter.com/#!/robgriffin247/status/198446041316593666/photo/1/large

Thanks in advance for your time,
Rob
(please save my weekend...)

--
View this message in context: http://r.789695.n4.nabble.com/ANOVA-problem-tp4609062.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list