#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#LATIN SQUARES
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#DATA
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
week_rep(1:4,rep(4,4))
inf_rep(1:4,4)
form_c("2","3","1","4","3","4","2","1","4","1","3","2","1","2","4","3")
matrix(form,4,4,byrow=F)
res_c(.4,.2,1.14,1.08,1.11,1.04,1.11,1.34,1.16,.57,1.32,1.73,.88,.8,1.38,1.55)
week_as.factor(week)
inf_as.factor(inf)
LS1.df_data.frame(res,week,inf,form)
LS1.df
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#A FIRST LOOK AT THE DATA
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
tapply(LS1.df$res,list(LS1.df$inf),mean)
tapply(LS1.df$res,list(LS1.df$week),mean)
tapply(LS1.df$res,list(LS1.df$form),mean)
tapply(LS1.df$res,list(LS1.df$form),var)^.5
plot.design(LS1.df)
par(mfrow=c(1,3))
plot.factor(LS1.df)
par(mfrow=c(2,2))
attach(LS1.df)
interaction.plot(week, form, res)
interaction.plot(inf, week, res)
interaction.plot(inf, form, res)
detach()
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#ANALYSIS
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LS1.aov_aov(res~week+inf+form,LS1.df)
summary(LS1.aov)
RE_100*(SLS1[1,3]+SLS1[1,1]*SLS1[4,3])/(SLS1[1,1]+1)/SLS1[4,3]
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#REPLICATED LATIN SQUARE
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#DATA
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
inf1_rep(1:4,16)
week1_rep(rep(1:4,rep(4,4)),4)
res1_c(LS1.df[1:16,1])
res12_c(1.55,.11,.22,.53,.89,1.05,.96,1.25,.16,.68,1.45,.61,.55,.98,.82,1.91)
res13_c(.27,.5,.32,.09,1.16,.7,1.63,.3,.59,.93,.55,1.34,.45,.96,.79,1.09)
res14_c(.73,.64,-.03,1.05,1.21,1.38,1.04,1.11,1.21,.82,.57,1,.77,.79,.55,.5)
res11_res1
res1_c(res11,res12,res13,res14)
squar_rep(1:4,rep(16,4))
inf1_as.factor(inf1)
week1_as.factor(week1)
squar_as.factor(squar)
infsqu_c(rep(1:4,4),rep(5:8,4),rep(9:12,4),rep(13:16,4))
infsqu_as.factor(infsqu)
LS2.df_data.frame(res1,week1,inf1,form1,squar,infsqu)
LS2.df
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#ANALYSIS
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
LS2.aov_aov(res1~infsqu+week1+form1,LS2.df)
summary(LS2.aov)