2. MODELO DE PRODUCCIÓN DELPROCESO DE INVERSIÓN DE LA CALIDAD
3.3 EVOLUCIÓN DE LA PRODUCTIVIDAD DEL PROCESO DE INVERSIÓN DE
√ √
∗ forms factorial expansion (Section
6.5)
√ √
- placed before model terms to ex-
clude them from the model
√ √
, placed at the end of a line to in-
dicate that the model specification continues on the next line
+ treated as a space √ √
!{ ... !} placed around some model terms when it is important the terms not be reordered (Section 6.4)
√
commonly used
at(f,n) condition on levelnof factorf.
nmay be a list of values
√ √
functions at(f) forms conditioning covariables for
all levels of factorf
√ √
fac(v) forms a factor from v with a level
for each unique value inv
√
fac(v,y) forms a factor with a level for each
combination of values invandy
√
lin(f) forms a variable from the factor
f with values equal to 1. . .n cor-
responding to level(1). . . level(n) of
the factor
√
spl(v[,k]) forms the design matrix for the ran-
dom component of a cubic spline for
variablev
6 Command file: Specifying the terms in the mixed model 97
Table 6.1: Summary of reserved words, operators and functions
model term brief description common usage
fixed random
other functions
t{n} fits variable n from the !G set of
variables t. This is a special case
of the !SUBGROUPqualifier function
applied to !Gvariables. Note that
the square parentheses are permit- ted alternative syntax.
√ √
and(t[,r]) addsr times the design matrix for
model termtto the previous design
matrix;rhas a default value of 1. If
tis complex if may be necessary to
predefine it by saying-t and(t,r)
c(f) factor f is fitted with sum to zero
constraints
√
cos(v,r) forms cosine fromvwith periodr √
ge(f) condition on factor/variablef>=r √
giv(f,n) associates the nth .giv G-inverse
with the factorf
√
gt(f) condition on factor/variablef> r √
h(f) factorfis fittedHelmertconstraints √
ide(f) fits pedigree factor f without rela-
tionship matrix
√
inv(v[,r]) forms reciprocal ofv + r √
le(f) condition on factor/variablef<=r √
leg(v,[-]n) formsn+1 Legendre polynomials of
order 0 (intercept), 1 (linear). . .n
from the values in v; the intercept
polynomial is omitted if v is pre-
ceded by the negative sign.
√
lt(f) condition on factor/variablef< r √
log(v[,r]) forms natural logarithm ofv + r √
ma1(f) constructs MA1 design matrix for
factorf
√
ma1 forms an MA1 design matrix from
plot numbers
6 Command file: Specifying the terms in the mixed model 98
Table 6.1: Summary of reserved words, operators and functions
model term brief description common usage
fixed random
mbf(v,r) is a factor derived from data factor
vby using the!MBFqualifier.
√ √
out(n) condition on observationn √
out(n,t) condition on recordn, traitt √
pol(v,[-]n) forms n+1 orthogonal polynomials
of order 0 (intercept), 1 (linear). . .n
from the values in v; the intercept
polynomial is omitted if n is pre-
ceded by the negative sign.
√
pow(x, p[,o]) defines the covariable (x+o)p for
use in the model wherexis a vari-
able in the data,pis a power ando
is an offset.
√
qtl(f,p) impute a covariable from marker
map information at positionp
√
sin(v,r) forms sine fromvwith periodr √
sqrt(v[,r]) forms square root ofv + r √
uni(f) forms a factor with a level for each
record where factorfis non-zero
√
uni(f,n) forms a factor with a level for each
record where factorfhas leveln
√
vect(v)
ASReml3
is used in a multivariate analysis on
a multivariate set of covariates (v)
to pair them with the variates
√ √
xfa(f,k) is formally a copy of factorfwithk
extra levels. This is used when fit- ting extended factor analytic mod-
els (XFA, Table 7.3) of orderk.
6 Command file: Specifying the terms in the mixed model 99
Examples
ASRemlcode action
yield ∼ mu variety fits a model with a constant and fixed variety effects
yield ∼ mu variety !r block fits a model with a constant term, fixed variety effects and random block effects
yield ∼ mu time variety time.variety fits a saturated model with fixed time and variety main effects and time by va- riety interaction effects
livewt ∼ mu breed sex breed.sex !r sire fits a model with fixed breed, sex and breed by sex interaction effects and ran- dom sire effects
6.3
Fixed terms in the model
Primary fixed terms
The fixedlist in the model formula
• describes the fixed covariates, factors and
interactions including special functions to be included in the table of Wald F statistics,
• generally begins with the reserved wordmu
which fits a constant term, mean or inter- cept, see Table 6.1.
NIN Alliance Trial 1989 variety . . . row 22 column 11
nin89.asd !skip 1 !mvinclude yield ∼ mu variety !r repl, !f mv
1 2
11 column AR1 .3 22 row AR1 .3
6 Command file: Specifying the terms in the mixed model 100
Sparse fixed terms
The !f sparse fixedterms in model formula
• are the fixed covariates (for example, the
fixed lin(row) covariate now included in the model formula), factors and interac- tions including special functions and re- served words (for examplemv, see Table 6.1) for which Wald F statistics are not required,
• include large (>100 levels) terms.
NIN Alliance Trial 1989 variety . . . row 22 column 11 nin89.asd !skip 1
yield ∼ mu variety !r repl,
!f mv lin(row)
1 2
11 column AR1 .424 22 row AR1 .904
6.4
Random terms in the model
The !r randomterms in the model formula
• comprise random covariates, factors and in-
teractions including special functions and reserved words, see Table 6.1,
• involve an initial non-zero variance compo-
nent or ratio (relative to the residual vari- ance) default 0.1; the initial value can be specified after the model term or if the vari- ance structure is not scaled identity, by syn- tax described in detail in Chapter 7,
NIN Alliance Trial 1989 variety . . . row 22 column 11 nin89.asd !skip 1
yield ∼ mu variety !r repl,
!f mv 1 2
11 column AR1 .424 22 row AR1 .904
• an initial value of its variance (ratio) may be followed by a!GP(keep positive,
the default),!GU (unrestricted) or!GF (fixed) qualifier, see Table 7.4,
• use !{ and !} to group model terms that may not be reordered. Normally
ASRemlwill reorder the model terms in the sparse equations - putting smaller terms first to speed up calculations. However, the order must be preserved if the user defines a structure for a term which also covers the following term(s) (a way of defining a covariance structure across model terms). Grouping is specifically required if the model terms are of differing sizes (number of effects). For example, for traits weaning weight and yearling weight, an animal model with maternal weaning weight should specify model terms
!{ Trait.animal at(Trait,1).dam !}
when fitting a genetic covariance between the direct and maternal effects.
6 Command file: Specifying the terms in the mixed model 101
6.5
Interactions and conditional factors
Interactions
• interactions are formed by joining two or more terms with a ‘.’ or a ‘:’, for
example, a.bis the interaction of factorsaand b,
• interaction levels are arranged with the levels of the second factor nested within
the levels of the first,
• labels of factors including interactions are restricted to 31 characters of which
only the first 20 are ever displayed. Thus for interaction terms it is often necessary to shorten the names of the component factors in a systematic way, for example, if Time and Treatment are defined in this order, the interaction between Time andTreatment could be specified in the model as Time.Treat; remember that the first match is taken so that if the label of each field begins with a different letter, the first letter is sufficient to identify the term,
• interactions can involve model functions.
Expansions
• +is ignored,
• -makes sure the following term is defined but does notinclude it in the model, • *indicates factorial expansion (up to 5 way)
a*b is expanded to a b a.b a*b*c*dis expanded to
a b c d a.b a.c a.d b.c b.d c.d a.b.c a.b.d a.c.d b.c.d a.b.c.d
• /indicates nested expansion
a/b is expanded to a a.b
ASReml2
• a.(b c d) eis expanded to a.b a.c a.d e. This syntax is detected by the
string ‘.(’ and the closing parenthesis must occur on the same line and before any comma indicating continuation. Any number of terms may be enclosed. Each may have ‘-’ prepended to suppress it from the model. Each enclosed term may have initial values and qualifiers following. For example,
yield∼site site.(lin(row) !r variety),
at(site,1).(row .3 col .2)
expands to
yield∼site site.lin(row) !r site.variety,
6 Command file: Specifying the terms in the mixed model 102
Conditional factors
A conditional factor is a factor that is present only when another factor has a particular level.
• individual components are specified using theat(f,n)function (see Table 6.2),
for example, at(site,1).row will fit rowas a factor only for site 1,
• a complete set of conditional terms are specified by omitting the level spec-
ASReml2
ification in the at(f) function provided the correct number of levels of f is specified in the field definitions. Otherwise, a list of levels may be specified.
– at(f).bcreates a series of model terms representing bnested within a for
any model term b. A model term is created for each level of a; each has the size of b. For example, if site and geno are factors with 3 and 10 lev- els respectively, then for at(site).geno ASRemlconstructs 3 model terms
at(site,1).geno at(site,2).geno at(site,3).geno, each with 10 levels,
– this is similar to forming an interaction except that a separate model term is
created for each level of the first factor; this is useful for random terms when each component can have a different variance. The same effect is achieved by using an interaction (e.g. site.geno) and associating a DIAG variance structure with the first component (see Section 7.5).
– any at() term to be expanded MUST be the FIRST component of the
Important
interaction.
geno.at(site) will not work.
at(site,1).at(year).geno will not work but
at(year).at(site,1).geno is OK.
– theat() factor must be declared with the correct number of levels because
the model line is expanded BEFORE the data is read. Thus if site is declared assite *orsite !A in the data definitions,
at(site).genowill expand to
at(site,01).geno at(site,02).geno
regardless of the actual number of sites. Associated Factors
Sometimes there is a hierarchical structure to factors which should be recognised as it aids formulation of prediction tables (see!ASSOCIATEqualifier on page 188). Common examples are Genotypesgrouped into Familiesand Locations grouped by Region. We call these associatedfactors. The key characteristic of associated ASReml3
factors is that they are coded such that the levels of one are uniquely nested in the levels of another. If one is unknown (coded as missing), all associated factors must
6 Command file: Specifying the terms in the mixed model 103
be unknown for that data record. It is typically unnecessary to interact associated factors except when required to adequately define the variance structure.