Title: | Linear Fixed/Mixed Effects Models for Diallel Crosses |
---|---|
Description: | Several service functions to be used to analyse datasets obtained from diallel experiments within the frame of linear models in R, as described in Onofri et al (2020) <DOI:10.1007/s00122-020-03716-8>. |
Authors: | Andrea Onofri [aut, cre], Niccolo Terzaroli [aut] |
Maintainer: | Andrea Onofri <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0.1 |
Built: | 2025-02-21 03:44:31 UTC |
Source: | https://github.com/onofriandreapg/lmdiallel |
This function takes a list of matrices and creates a block diagonal matrix. It is used to fit multi-environment diallel models
blockMatrixDiagonal(matList)
blockMatrixDiagonal(matList)
matList |
It is a list of matrices to be combined |
Returns a matrix object
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theoretical Applied Genetics (2020). https://doi.org/10.1007/s00122-020-03716-8
a <- matrix(1:16, 8, 2) b <- matrix(1:9, 3, 3) c <- list(a, b) blockMatrixDiagonal(c)
a <- matrix(1:16, 8, 2) b <- matrix(1:9, 3, 3) c <- list(a, b) blockMatrixDiagonal(c)
DD effect to fit Hayman2 model with lm
function
DD(P1, P2, type = "fix", data)
DD(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the DD effect
Andrea Onofri, Niccolo' Terzaroli , Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") contrasts(hayman54$Block) <- "contr.sum" dMod <- lm(Ftime ~ Block + GCA(Par1, Par2) + MDD(Par1, Par2) + DD(Par1, Par2) + SCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2), data = hayman54) summary(dMod)
data("hayman54") contrasts(hayman54$Block) <- "contr.sum" dMod <- lm(Ftime ~ Block + GCA(Par1, Par2) + MDD(Par1, Par2) + DD(Par1, Par2) + SCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2), data = hayman54) summary(dMod)
Multi-environment half-diallel dataset with six parentals, in five blocks and ten environments; the dataset is factitious and was obtained by Monte Carlo simulation.
data("diallelMET")
data("diallelMET")
A data.frame with 1050 observations on the following 5 variables.
Env
environment, a factor with 10 levels
Block
block, a factor with 5 levels
Par1
male parent, a factor with 6 levels
Par2
female parent, a factor with 6 levels
Yield
yield, a numeric vector
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("diallelMET")
data("diallelMET")
Diallel model parameters are estimated under a set of restrictions and, therefore, the methods 'coef' and 'summary' do not return the full list of genetical parameters. Therefore, the 'glht.diallelMod' method can be used, which works by way of a series of helper functions, providing the necessary contrast matrices.
## S3 method for class 'diallelMod' glht(model, linfct, ...)
## S3 method for class 'diallelMod' glht(model, linfct, ...)
model |
a model object (OPTIONAL) |
linfct |
a diellel.eff() function |
... |
Other optional arguments |
...
summary
Returns the full list of genetical parameters
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
library(lmDiallel) library(multcomp) # Data with replicates data("hayman54") fit <- lm.diallel(Ftime ~ Par1 + Par2, data = hayman54, fct = "HAYMAN1") summary(fit) anova(fit) gh <- glht(linfct = diallel.eff(fit))
library(lmDiallel) library(multcomp) # Data with replicates data("hayman54") fit <- lm.diallel(Ftime ~ Par1 + Par2, data = hayman54, fct = "HAYMAN1") summary(fit) anova(fit) gh <- glht(linfct = diallel.eff(fit))
This is a modification of the 'expand.grid()' function working specifically with diallel experiments. It creates a data frame from all combinations of the supplied vector of parents, depending on the mating scheme.
expand.diallel(pars, mating = 1)
expand.diallel(pars, mating = 1)
pars |
|
mating |
The type of mating scheme. 1: full diallel experiment; 2: no reciprocals; 3: no selfs; 4: no reciprocals and no selfs |
returns a data.frame object
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
pars <- LETTERS[1:4] expand.diallel(pars, mating = 3)
pars <- LETTERS[1:4] expand.diallel(pars, mating = 3)
GCA effect to fit Hayman1 & 2 and Griffing 1 & 2 models with lm
function
GCA(P1,P2,type = "fix", data)
GCA(P1,P2,type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the GCA effect
Andrea Onofri, Niccolo' Terzaroli , Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") contrasts(hayman54$Block) <- "contr.sum" dMod<-lm(Ftime ~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
data("hayman54") contrasts(hayman54$Block) <- "contr.sum" dMod<-lm(Ftime ~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
Design matrix for GCAC, useful to fit Gardner & Eberhart model 3 (GE3) with lm
function
GCAC(P1,P2,type = "fix", data)
GCAC(P1,P2,type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the GCAC effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") GCAC(Par1,Par2, data=hayman54)
data("hayman54") GCAC(Par1,Par2, data=hayman54)
Data for a diallel in maize, with no selfs and no selfed parents. Data are the means of several replicates.
data("griffing56")
data("griffing56")
A data.frame with 36 observations on the following 5 variables
Par1
male parent, a factor with 8 levels
Par2
female parent, a factor with 8 levels
Yield
Maize Yield
Cob
Cob weight
Shelled
Shelled corn weight
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Griffing, B., 1956. Concept of general and specific combining ability in relation to diallel crossing systems. Australian Journal of Biological Science 9, 463–493.
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("griffing56") dMod2 <- lm.diallel(Yield ~ Par1 + Par2, data = griffing56, fct = "GRIFFING4") anova(dMod2, MSE = 21.05, dfr = 2558) summary(dMod2, MSE = 21.05, dfr = 2558)
data("griffing56") dMod2 <- lm.diallel(Yield ~ Par1 + Par2, data = griffing56, fct = "GRIFFING4") anova(dMod2, MSE = 21.05, dfr = 2558) summary(dMod2, MSE = 21.05, dfr = 2558)
H.BAR effect to fit GE2 and GE3 models with lm
function
H.BAR(P1, P2, type = "fix", data)
H.BAR(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
A design matrix for the H.BAR effect
Andrea Onofri, Niccolo' Terzaroli , Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
Data for a diallel in tobacco with 2 reps
data(hayman54)
data(hayman54)
A data.frame with 128 observations on the following 4 variables
Block
block, a factor with 2 levels
Par1
male parent, a factor with 8 levels
Par2
female parent, a factor with 8 levels
Ftime
mean flowering time (days), a numeric vector
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
B. I. Hayman (1954a). The Analysis of Variance of Diallel Tables. Biometrics, 10, 235-244. Table 5, page 241. http://doi.org/10.2307/3001877
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") contrasts(hayman54$Block) <- c("contr.sum") dMod <- lm(Ftime ~ Block + GCA(Par1, Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2), data = hayman54) anova(dMod) #or dMod2 <- lm.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") anova(dMod2)
data("hayman54") contrasts(hayman54$Block) <- c("contr.sum") dMod <- lm(Ftime ~ Block + GCA(Par1, Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2), data = hayman54) anova(dMod) #or dMod2 <- lm.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") anova(dMod2)
H.i effect to fit GE2 Model with lm
function
Hi(P1, P2, type = "fix", data)
Hi(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the Hi effect
Andrea Onofri, Niccolo' Terzaroli , Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
These functions are used internally by the package.
int.matrix(Xa, Xb) checkScheme(P1, P2)
int.matrix(Xa, Xb) checkScheme(P1, P2)
Xa |
Incidence matrix of genetic effects |
Xb |
Incidence matrix for an external factor |
P1 |
A vector with parentals |
P2 |
A vector with parentals |
No more detail, so far.
The function 'int.matrix()' returns an incidence matrix. The function 'checkScheme()' returns a list, containing the main traits of the mating scheme.
No further notes
Andrea Onofri
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data(griffing56) head(griffing56) checkScheme(griffing56$Par1, griffing56$Par2)
data(griffing56) head(griffing56) checkScheme(griffing56$Par1, griffing56$Par2)
Wrapper function for lm.fit and diallel models. It can be used to carry out several powerful methods for linear models, such as 'summary()', anova() or 'glht()' in the 'multcomp' package.
lm.diallel(formula, Block, Env, fct = "GRIFFING2", data)
lm.diallel(formula, Block, Env, fct = "GRIFFING2", data)
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.'formula' uses the regular R syntax to specify the response variable and the two variables for parentals |
Block |
used to specify an optional variable coding for blocks |
Env |
used to specify an optional variable coding for environments |
fct |
a string variable coding for the selected model. 8 main diallel models: Hayman's model 1 (="HAYMAN1"), Hayman's model 2 (="HAYMAN2"), Griffing's model 1 (="GRIFFING1"), Griffing's model 2 (="GRIFFING2"), Griffing's model 3 (="GRIFFING3"), Griffing's model 4 (="GRIFFING4"), Gardner-Eberhart model 2 (="GE2") and Gardner-Eberhart model 3 (="GE3"). The strings "GE2r" and "GE3r" can be used to specify the 'enhanced' GE2 and GE3 models, including the effect of reciprocals (REC). |
data |
a 'data.frame' where to look for explanatory variables |
Notations for the 8 models
Model name in 'lm.diallel()' | Model notation in 'lm()' |
HAYMAN1 | Y ~ GCA(Par1, Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2) |
GRIFFING1 | Y ~ GCA(Par1, Par2) + tSCA(Par1, Par2) + REC(Par1, Par2) |
GRIFFING2 | Y ~ GCA(Par1, Par2) + tSCA(Par1, Par2) |
HAYMAN2 | Y ~ GCA(Par1, Par2) + MDD(Par1, Par2) + DD(Par1, Par2) + SCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2) |
GE2 | Y ~ H.BAR(Par1, Par2) + VE.i(Par1, Par2) + H.i(Par1, Par2) + SCA(Par1, Par2) |
GE3 | Y ~ H.BAR(Par1, Par2) + SP(Par1, Par2) + GCAC(Par1, Par2) + SCA(Par1, Par2) |
GE2r | Y ~ H.BAR(Par1, Par2) + VE.i(Par1, Par2) + H.i(Par1, Par2) + SCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2) |
GE3r | Y ~ H.BAR(Par1, Par2) + SP(Par1, Par2) + GCAC(Par1, Par2) + SCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1, Par2) |
lm.diallel returns an object of class c("diallel", "lm"), that is a list containing at least the following components:
coefficients
a named vector of coefficients
residuals
the residuals, that is response minus fitted values
fitted.values
the fitted mean values
rank
the numeric rank of the fitted linear models
weights
(only for weighted fits) the specified weights
df.residual
the residual degrees of freedom
call
the matched call
terms
the terms object used
contrasts
(only where relevant) the contrasts used
xlevels
(only where relevant) a record of the levels of the factors used in fitting
call
the matched call
offset
the offset used (missing if none were used)
y
if requested, the response used
x
if requested, the model matrix used
model
if requested (the default), the model frame used
na.action
(where relevant) information returned by model.frame on the special handling of NAs
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") dMod <- lm.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") anova(dMod) #or data("zhang05") contrasts(zhang05$Block) <- c("contr.sum") dMod2 <- lm.diallel(Yield ~ Par1 + Par2, Env = Env, Block = Block, data = zhang05, fct = "GE2") #or data("lonnquist61") dMod3 <- lm.diallel(Yield ~ Par1 + Par2, data = lonnquist61, fct = "GE2") summary(dMod3, MSE = 7.10, dfr = 60) anova(dMod3, MSE = 7.10, dfr = 60)
data("hayman54") dMod <- lm.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") anova(dMod) #or data("zhang05") contrasts(zhang05$Block) <- c("contr.sum") dMod2 <- lm.diallel(Yield ~ Par1 + Par2, Env = Env, Block = Block, data = zhang05, fct = "GE2") #or data("lonnquist61") dMod3 <- lm.diallel(Yield ~ Par1 + Par2, data = lonnquist61, fct = "GE2") summary(dMod3, MSE = 7.10, dfr = 60) anova(dMod3, MSE = 7.10, dfr = 60)
The object returned by the 'lm.diallel()' function is of classes 'lm' and 'diallel'. Specific methods were devised to explore the 'diallel' object.
## S3 method for class 'diallel' summary(object, MSE, dfr, ...) ## S3 method for class 'diallel' vcov(object, MSE, ...) ## S3 method for class 'diallel' anova(object, MSE, dfr, type = 1, ...) ## S3 method for class 'diallel' model.matrix(object, ...)
## S3 method for class 'diallel' summary(object, MSE, dfr, ...) ## S3 method for class 'diallel' vcov(object, MSE, ...) ## S3 method for class 'diallel' anova(object, MSE, dfr, type = 1, ...) ## S3 method for class 'diallel' model.matrix(object, ...)
object |
an object of class diallel. |
MSE |
Mean Square Error, when it cannot be derived from model fit |
dfr |
Residual degrees of freedom, when they cannot be derived from model fit |
type |
It is used to select between Type I (sequential) or Type III (marginal) F tests in ANOVA |
... |
Other optional arguments |
To be defined
vcov.diallel
: a variance-covariance matrix
summary.diallel
: a data.frame of estimated parameters with standard errors
anova.diallel
: an ANOVA table
predict.diallel
: a vector of predictions from a diallel model
model.matrix.diallel
: a design matrix for the fitted diallel model
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
library(lmDiallel) library(multcomp) # Data with replicates data("hayman54") fit <- lm.diallel(Ftime ~ Par1 + Par2, data = hayman54, fct = "HAYMAN1") summary(fit) anova(fit) gh <- glht(linfct = diallel.eff(fit), adjust = "none")
library(lmDiallel) library(multcomp) # Data with replicates data("hayman54") fit <- lm.diallel(Ftime ~ Par1 + Par2, data = hayman54, fct = "HAYMAN1") summary(fit) anova(fit) gh <- glht(linfct = diallel.eff(fit), adjust = "none")
Diallel experiment with six maize varieties and no reciprocals. The data here are means adjusted for block effects.
data("lonnquist61")
data("lonnquist61")
A data.frame with 21 observations on the following 3 variables.
Par1
male parent, a factor with 6 levels
Par2
female parent, a factor with 6 levels
Yield
mean across blocks, a numeric vector
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
J. H. Lonnquist, C. O. Gardner. (1961) Heterosis in Intervarietal Crosses in Maize and Its Implication in Breeding Procedures. Crop Science, 1, 179-183. Table 1.
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
Mohring, Melchinger, Piepho. (2011). REML-Based Diallel Analysis. Crop Science, 51, 470-478. http://doi.org/10.2135/cropsci2010.05.0272
C. O. Gardner and S. A. Eberhart. 1966. Analysis and Interpretation of the Variety Cross Diallel and Related Populations. Biometrics, 22, 439-452. http://doi.org/10.2307/2528181
data("lonnquist61") dMod <- lm(Yield ~ H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2), data = lonnquist61) summary.diallel(dMod, MSE = 7.10, dfr = 60) anova.diallel(dMod, MSE = 7.10, dfr = 60)
data("lonnquist61") dMod <- lm(Yield ~ H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2), data = lonnquist61) summary.diallel(dMod, MSE = 7.10, dfr = 60) anova.diallel(dMod, MSE = 7.10, dfr = 60)
It creates a disign matrix for block effects (with sum-to-zero constraint). It is used internally
matBlock(formula)
matBlock(formula)
formula |
|
A design matrix for the block effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") matBlock(~hayman54$Block)
data("hayman54") matBlock(~hayman54$Block)
It relates to the difference between the average yield of selfed parents and the average yield of crosses. DD effect to fit Hayman2 model with lm
function
MDD(P1, P2, type = "fix", data)
MDD(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
A design matrix for the MDD effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") MDD(Par1, Par2, data = hayman54)
data("hayman54") MDD(Par1, Par2, data = hayman54)
Wrapper function for the function 'mmer()' in the 'sommer' package. It can be used to fit random diallel models and retreive variance components for main effects.
mmer.diallel(formula, Block, Env, fct, data, type = "all")
mmer.diallel(formula, Block, Env, fct, data, type = "all")
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.'formula' uses the regular R syntax to specify the response variable and the two variables for parentals |
Block |
used to specify an optional variable coding for blocks |
Env |
used to specify an optional variable coding for environments |
data |
a 'data.frame' where to look for explanatory variables |
fct |
a string variable coding for the selected model. 8 main diallel models: Hayman's model 1 (="HAYMAN1"), Hayman's model 2 (="HAYMAN2"), Griffing's model 1 (="GRIFFING1"), Griffing's model 2 (="GRIFFING2"), Griffing's model 3 (="GRIFFING3"), Griffing's model 4 (="GRIFFING4"), Gardner-Eberhart model 2 (="GE2") and Gardner-Eberhart model 3 (="GE3"). The strings "GE2r" and "GE3r" can be used to specify the 'enhanced' GE2 and GE3 models, including the effect of reciprocals (REC). |
type |
a string variable coding for the selected model. It is only used for multi-environment experiments and it is equal to "all" when both the environment and genetical effects are random or "environment" when the environment is random and genetical effects are fixed. |
Returns a data frame of variance components with standard errors
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Covarrubias-Pazaran, G., 2016. Genome-Assisted Prediction of Quantitative Traits Using the R Package sommer. PLOS ONE 11, e0156744. https://doi.org/10.1371/journal.pone.0156744
data("hayman54") rMod <- mmer.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") rMod
data("hayman54") rMod <- mmer.diallel(Ftime ~ Par1 + Par2, Block = Block, data = hayman54, fct = "HAYMAN1") rMod
model.matrixDiallel
is useful to build design matrices, according to the user-defined (or default) parameterisation for lm
function. It shares the same syntax of the lm.diallel
function.
formula |
an object of class "formula" (or one that can be coerced to that class): a symbolic description of the model to be fitted.'formula' uses the regular R syntax to specify the response variable and the two variables for parentals |
Block |
used to specify an optional variable coding for blocks |
Env |
used to specify an optional variable coding for environments |
data |
a 'data.frame' where to look for explanatory variables |
fct |
a string variable coding for the selected model. 6 main diallel models: Hayman's model 1 (="HAYMAN1"), Hayman's model 2 (="HAYMAN2"), Griffing's model 1 (="GRIFFING1"), Griffing's model 2 (="GRIFFING2"), Gardner-Eberhart model 2 (="GE2") and Gardner-Eberhart model 3 (="GE3"). The strings "GE2r" and "GE3r" can be used to specify the 'enhanced' GE2 and GE3 models, including the effect of reciprocals (REC). |
model.matrixDiallel creates a design matrix for a diallel model, as specified in the 'fct' argument.
The design matrix for a diallel model as specified in the 'fct' argument.
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("diallelMET") ModMat <- model.matrixDiallel(Yield ~ Par1 + Par2, Env, Block, fct= "GE3", data = diallelMET)
data("diallelMET") ModMat <- model.matrixDiallel(Yield ~ Par1 + Par2, Env, Block, fct= "GE3", data = diallelMET)
Build incidence matrix to fit reciprocal effects in Griffing's model 1, 2, 4 (REC) and 3 (REC.G3) with lm
function
REC(P1, P2, type = "fix", data)
REC(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the reciprocal (REC) effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) +tSCA(Par1, Par2)+REC(Par1, Par2) , data = hayman54) anova(dMod)
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) +tSCA(Par1, Par2)+REC(Par1, Par2) , data = hayman54) anova(dMod)
RGCA effect to fit Hayman1 & 2 models with lm
function
RGCA(P1,P2,type = "fix", data)
RGCA(P1,P2,type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the RGCA effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
RSCA effect to fit Hayman 1 & 2 models with lm
function
RSCA(P1,P2,type = "fix",data)
RSCA(P1,P2,type = "fix",data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of all possible combinations between parentals with no selfs and no reciprocals
A design matrix for the RSCA effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
SCA effect to fit Hayman2, Griffing3 (SCA.G3), GE2 and GE3 (SCA.GE) models with lm
function
SCA(P1, P2, type = "fix", data) SCA.G3(P1, P2, type = "fix", data)
SCA(P1, P2, type = "fix", data) SCA.G3(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of all possible combinations between parentals with no selfs and no reciprocals
A design matrix for the SCA effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
SP effect to fit GE3 model with lm
function
SP(P1, P2, type = "fix", data)
SP(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the SP effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") SP(Par1,Par2, data=hayman54)
data("hayman54") SP(Par1,Par2, data=hayman54)
Total SCA to fit Hayman1, Griffing1 and Griffing2 models with lm
function
tSCA(P1,P2,type = "fix", data)
tSCA(P1,P2,type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of all possible combinations between parentals with selfs but no reciprocals
A design matrix for the tSCA effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
data("hayman54") dMod<-lm(Ftime~ Block + GCA(Par1,Par2) + tSCA(Par1, Par2) + RGCA(Par1, Par2) + RSCA(Par1,Par2), data = hayman54) anova(dMod)
VE.i effect to fit GE2 model with lm
function
VEi(P1, P2, type = "fix", data)
VEi(P1, P2, type = "fix", data)
P1 |
|
P2 |
|
type |
|
data |
|
a design matrix of n-1 parentals
A design matrix for the VEi effect
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
data("zhang05") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + VEi(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod)
Data collected in XXX with 5 parents, 2 reps and 2 environments
data("zhang05")
data("zhang05")
A data.frame with 60 observations on the following 6 variables.
Par1
male parent, a factor with 5 levels
Par2
female parent, a factor with 5 levels
Block
block, a factor with 2 levels
Combination
combination between environment and block, an integer vector
Env
environment, a factor with 2 levels
Yield
yield, a numeric vector
Andrea Onofri, Niccolo' Terzaroli, Luigi Russi
Zhang, Y., Kang, M.S. and Lamkey, K.R. (2005), DIALLEL-SAS05: A Comprehensive Program for Griffing's and Gardner&Eberhart Analyses. Agron. J., 97: 1097-1106. https://doi.org/10.2134/agronj2004.0260
Onofri, A., Terzaroli, N. & Russi, L. Linear models for diallel crosses: a review with R functions. Theor Appl Genet (2020). https://doi.org/10.1007/s00122-020-03716-8
data("zhang05") contrasts(zhang05$Block) <- c("contr.sum") contrasts(zhang05$Env) <- c("contr.sum") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + GCA(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod) #or dMod2 <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2), data = zhang05) summary(dMod2)$coefficients
data("zhang05") contrasts(zhang05$Block) <- c("contr.sum") contrasts(zhang05$Env) <- c("contr.sum") dMod <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2) + H.BAR(Par1, Par2):Env + GCA(Par1, Par2):Env + Hi(Par1, Par2):Env + SCA(Par1, Par2):Env, data = zhang05) anova(dMod) #or dMod2 <- lm(Yield ~ Env/Block + H.BAR(Par1, Par2) + VEi(Par1, Par2) + Hi(Par1, Par2) + SCA(Par1, Par2), data = zhang05) summary(dMod2)$coefficients