####=========================================####
#### For CRAN time limitations most lines in the
#### examples are silenced with one '#' mark,
#### remove them and run the examples
####=========================================####
####=========================================####
#### EXAMPLES
#### Different models with sommer
####=========================================####
data(DT_example)
DT <- DT_example
A <- A_example
head(DT)
####=========================================####
#### Univariate homogeneous variance models ####
####=========================================####
## Compound simmetry (CS) model
ans1 <- mmer(Yield~Env,
random= ~ Name + Env:Name,
rcov= ~ units,
data=DT)
summary(ans1)$varcomp
ans1b <- mmec(Yield~Env,
random= ~ Name + Env:Name,
rcov= ~ units,
data=DT)
summary(ans1b)$varcomp
# ####===========================================####
# #### Univariate heterogeneous variance models ####
# ####===========================================####
#
# ## Compound simmetry (CS) + Diagonal (DIAG) model
# ans2 <- mmer(Yield~Env,
# random= ~Name + vsr(dsr(Env),Name),
# rcov= ~ vsr(dsr(Env),units),
# data=DT)
# summary(ans2)
#
# DT=DT[with(DT, order(Env)), ]
# ans2b <- mmec(Yield~Env,
# random= ~Name + vsc(dsc(Env),isc(Name)) +
# vsc(atc(Env, c("CA.2011") ),isc(Block)) ,
# rcov= ~ vsc(dsc(Env),isc(units)),
# data=DT)
# summary(ans2b)
#
# ####==========================================####
# #### Multivariate homogeneous variance models ####
# ####==========================================####
#
# ## Multivariate Compound simmetry (CS) model
# DT$EnvName <- paste(DT$Env,DT$Name)
# ans4 <- mmer(cbind(Yield, Weight) ~ Env,
# random= ~ vsr(Name) + vsr(EnvName),
# rcov= ~ vsr(units),
# data=DT)
# summary(ans4)
Run the code above in your browser using DataLab