lm.diallel: Fitting diallel linear models

View source: R/lm.diallel_v2.0.R

lm.diallelR Documentation

Fitting diallel linear models

Description

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.

Usage

lm.diallel(formula, Block, Env, fct = "GRIFFING2", data)

Arguments

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 (e.g., Yield ~ Par1 + Par2)

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

Details

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)

Value

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

Author(s)

Andrea Onofri, Niccolo' Terzaroli, Luigi Russi

References

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

Examples

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)

OnofriAndreaPG/lmDiallel documentation built on April 23, 2023, 1:39 p.m.