Académique Documents
Professionnel Documents
Culture Documents
Mick O’Neill
In recent years a general algorithm, Restricted Maximum Likelihood (REML) has been
developed for estimating variance parameters in linear mixed models (LMM).
This manual will review classic statistical techniques (ANOVA & REGRESSION) and
demonstrate how LMM (REML) can be used to analyse normally distributed data from
virtually any situation. For balanced data, REML reproduces the statistics familiar to those
who use ANOVA, but the algorithm is not dependent on balance. It allows for spatial and/or
temporal correlations, so can be used for repeated measures or field-correlated data. Unlike
ANOVA, REML allows for changing variances, so can be used in experiments where some
treatments (for example different spacings, crops growing over time, treatments that include a
control) have a changing variance structure. The statistical package GenStat is used
throughout. The current version is 13, although the analyses can generally be performed
using the Discovery Edition released in 2010.
We have not separated the LMM (REML) section from ANOVA in this manual. The reason
is clear. ANOVA is an appropriate analysis for a model
where the random error terms are normal, independent, each with constant variance. This
model includes simple random sampling (there are no random effects), regression, t tests and
analysis of variance F tests.
where the random error terms are normal, possibly correlated, with possibly unequal
variances. The algorithm does not insist on balanced data, unlike ANOVA.
In general, data from two familiar text books will be used as examples. The editions we used
are the following.
Statistical Advisory & Training Service Pty Ltd
Snedecor, G.W. and Cochran, W.G. (1980). Statistical Methods. Seventh Edition. Ames
Iowa: The Iowa State University Press.
Steel, R.G.D. and Torrie, J.H. (1980). Principles and Procedures of Statistics: a Biometrical
Approach. Second Edition. New York: McGraw-Hill Kogakusha.
Several examples were kindly supplied by Curt Lee (Agro-Tech, Inc., Velva, North Dakota,
USA). Other sources for data include:
Cochran, W. and Cox, G. (1957). Experimental Designs. Second Edition. Wiley 1957.
Diggle, P.J. (1983). Statistical Analysis of Spatial Point Patterns. London: Academic Press.
McConway, K. (1950). Statistical modelling using GENSTAT / K.J. McConway and M.C.
Jones, P.C. Taylor. London : Arnold in association with the Open University.
Mead, R. and Curnow, R.N. (1990). Statistical methods in agricultural and experimental
biology. Chapman and Hall, London.
Pearce, S.C. (1976). Field experimentation with fruit trees and other perennial plants. Second
Edition. Farnham Royal: Commonwealth Agricultural Bureaux.
Reynolds, P.S. (1994). Time-series analyses of beaver body temperatures. In Case Studies in
Biometry. N. Lange, L. Ryan, L. Billard, D. Brillinger, L. Conquest and J. Greenhouse
(editors), 211–228. New York: John Wiley.
Schabenberger, O. and Pierce, F.J. (2001). Contemporary statistical models for the plant and
soil sciences.
Sokal, R.R. and Rohlf, F.J. (1995). Biometry. The Principles and Practice of Statistics in
Biological Research. Third Edition. New York: W.H Freeman and Company.
The training manual was prepared by Mick O’Neill from the Statistical Advisory &
Training Service Pty Ltd. Contact details are as follows.
2
CRD repeated measures example ................................................................................. 134
Repeated Measurements > Correlated Models by REML menu ...................... 136
Unstructured, autoregressive/power and antedependence models.................... 139
Akaike's information criterion (AIC) and Schwartz information
coefficient (SC) ................................................................................................. 143
RCBD repeated measures example - experiments repeated annually .......................... 146
LMM (REML) analysis .................................................................................... 147
Multivariate Linear Mixed Models for CRD ................................................................ 154
Multivariate analysis of variance (MANOVA) for CRD ............................................. 155
Multivariate analysis of variance (MANOVA) for a blocked design ........................... 158
Moreover, the analysis we perform is always associated with an underlying model that
involves any factors in the experiment and includes any random terms (like experimental
error).
In this manual we will demonstrate these concepts starting from the most simple random
sampling, and show that linear mixed models (LMM) with a residual maximum likelihood
(REML) algorithm is a general model with an associated analysis that includes regression,
time series and analysis of variance (ANOVA) as special cases.
Example 1 Coefficients of digestibility of dry matter, fed corn silage, in percent (Steel and
Torrie, page 93) fed to randomly selected sheep
We are clearly interested in estimating the mean coefficient of digestibility for sheep, µ,
hoping that these n = 7 randomly chosen sheep are representative of the entire population. We
are also interested in estimating the variation in coefficients of digestibility, expressed say as
a variance, σ2.
Assume now that the coefficient of digestibility, Y, is normally distributed, ie Y ~ N(µ, σ2).
Then the simple model is that for each randomly chosen sheep, its coefficient of digestibility
will differ from the mean value µ only by a random amount, which is what we call the error.
The errors for the 7 sheep are all assumed independent,
where Error ~ N(0, σ2). The parameter µ is a fixed parameter, and the parameter σ2 is the
only parameter in the random part of the model.
where the only fixed parameter is µ. Alternatively, we can pull µ out and express the model
as
1
Statistical Advisory & Training Service Pty Ltd
where in this case there are no additional fixed effects (like possible breed effects which
make the mean coefficient of digestibility different across breeds).
Parameters of distributions are often estimated using the technique of maximum likelihood
(ML) estimation. This technique maximizes what is known as the likelihood, though it is
equivalent, and often easier, to maximize the log-likelihood. For the normal population, the
likelihood of a random sample of size n is simply the product of the density function of the
normal distribution evaluated at each of the data points. The log-likelihood is therefore
2
1 n Y −µ
log L = − ln ( 2πσ 2 ) − ∑ i
n
.
2 2 i =1 σ
∑ (Y − y )
i =1
i
2
µˆ = y , σˆ 2ML = = sn2 .
n
For these data, the ML estimates are µˆ = 56.214 , sn2 = 7.727 , sn = 2.780.
Early monographs such as Steel and Torrie and Snedecor and Cochran introduced the idea of
estimating parameters like the mean µ and standard deviation σ of a normal population
without reference to the concept of maximum likelihood. They used n as a divisor of the
variance estimate rather than (n-1). To justify this, they talk about bias or sampling with and
without replacement. Some authors talk about using n as the divisor when calculating the
population variance and (n-1) when calculating the sample variance. Indeed, scientific
calculators have σn and σn-1 buttons. Excel has VARP and VAR formulae for the two sorts of
variances (which we label sn2 and sn2−1
respectively), and STDEVP and STDEV
for the equivalent standard deviations.
2
Statistical Advisory & Training Service Pty Ltd
Quartiles:
25% 50% 75%
53.6 55.4 54.0
Summary of analysis
Observations: Sheep
Parameter estimates from individual data values
Distribution: Normal (Gaussian)
X distributed as Normal(m,s**2)
Deviance: 0.21 on 0 d.f.
ML estimate of µ
The idea of residual maximum likelihood (REML) is only a couple of decades old. The idea
is this:
We take the likelihood and partition it into two components. The first component is a
likelihood of one or more statistics and involves all fixed parameters like µ (and may involve
variance parameters as well). The second component is a residual likelihood and involves
only the variance parameters of the random effects. We then maximize each component
separately. The estimates of the variance parameters are known as REML estimates.
For samples from a normal population, the first component turns out to be the likelihood for
the sample mean y , the second likelihood is that of variates associated with the sample
variance. Specifically,
log = −
ln2π
/ −
/ + − ln2
−
ln −
∑
!
√
3
Statistical Advisory & Training Service Pty Ltd
∑ (Y − y )
i
2
σˆ 2REML = i =1
= sn2−1 , µˆ = y .
n −1
Thus, the familiar estimate for σ2 is actually a REML estimate, sn2−1 = 9.015 , and this
estimate is unbiased. For more complex models, the REML estimate is less biased than the
ML estimate.
For the sheep data, REML estimates are available using the menu Stats > Mixed Models (REML)
> Linear Mixed Models… In this menu GenStat will always fit a constant term (µ) and, if you do
not include an error term, it will add one for you. Simply enter the coefficient of digestibility
column as the Y-variate and leave the Fixed Model and Random Model blank. We need to click
Predicted Means in Options, and as a general rule, click Deviance as well.
4
Statistical Advisory & Training Service Pty Ltd
Notice in the output that a “Residual term has been added to model”. We can deliberately put an
error term if we wish (for example, if we decide to include a correlation into our model). For
a sample of size n there are n error terms, each being independent with the same distribution,
N(0, σ2). We therefore need to set up a factor that contains n levels corresponding to the n
data values. In this case we would set up a factor column with levels 1, …, 7 called say
Replicate and use Replicate as the Random Model. Alternatively, GenStat has an in-built device
to do this: simply type '*Units*' in the Random Model.
Deviance
Deviance: -2*Log-Likelihood
Deviance d.f.
21.14 5
Deviance plays the role that the Residual SS plays in ANOVA. The deviance that GenStat
prints out is proportional to -2×LogL, where LogL is the log-likelihood of the variance
components. (The actual definition actually has the constant 2π removed):
Deviance really is only used to compare models where the null hypothesis involves the
variance parameter of a random effect. Asymptotically, a change in deviance for one (nested)
model compared to a larger model follows a χ2 distribution, and the degrees of freedom to
use are the change in df. The nested model arises by replacing in the larger model the new
parameters that are given in the null hypothesis.
Correlated samples
Using a REML algorithm in experiments involving fixed effects and random effects is not
restricted to independent data, or to data with the same variance in any one stratum. It is an
extremely flexible estimating tool, and has become the standard way of analyzing data from
agricultural trials.
This manual is not a place to describe in great detail the concepts of correlated data over time.
At this point all we want to do is demonstrate that very often we need to analyze data that is
serially correlated.
A good example to illustrate serially correlated data is the famous beaver body temperatures
taken every 10 minutes, taken from Case Studies in Biometry (Lange et al. 1994). A plot of
these temperatures for a single animal is shown on the left hand page, and for comparison, a
plot of notional temperatures randomly sampled from a normal distribution at each time with
the same mean and variance as the overall beaver temperatures had. It is clear that there is an
essential difference between the two plots.
5
Statistical Advisory & Training Service Pty Ltd
37.4
Temperature (°°C)
37.2
37.0
36.8
36.6
36.4
36.2
08:40 10:40 12:40 14:40 16:40 18:40 20:40 22:40 00:40 02:40
Time
37.4
Temperature (°°C)
37.2
37.0
36.8
36.6
36.4
36.2
08:40 10:40 12:40 14:40 16:40 18:40 20:40 22:40 00:40 02:40
Time
6
Statistical Advisory & Training Service Pty Ltd
To emphasize the difference even more strongly, here are plots of the temperatures at time t
plotted against the temperatures at time t-1.
37.4
Temperature (°°C)
37.2
37.0
36.8
36.6
36.4
36.2
36.2 36.4 36.6 36.8 37.0 37.2 37.4 37.6
Previous temperature (°C)
37.4
Temperature (°°C)
37.2
37.0
36.8
36.6
36.4
36.2
36.2 36.4 36.6 36.8 37.0 37.2 37.4 37.6
Previous temperature (°C)
The temperatures of a single beaver are clearly correlated in time: we call this a serial
correlation. The model is the same as the previous model for coefficients of digestibility,
only the assumptions underlying the model are different:
where Error ~ N(0, σ2), however some correlation structure exists among the individual error
terms. This is the subject of time series analysis.
7
Statistical Advisory & Training Service Pty Ltd
37.4 0.75
0.50
37.2
0.25
Values
37.0
ACF
0.00
36.8 0 10 20 30 40 50
-0.25
Lag
36.6 -0.50
-0.75
36.4
-1.00
20 40 60 80 100
Time
40
0.00
0 10 20 30 40 50 30
-0.25
Lag 20
-0.50
-0.75 10
-1.00 0
0.0 0.1 0.2 0.3 0.4 0.5
Frequency
Time series plots for random data with same mean and standard deviation
Sample values of time series: Temp_Random Sample autocorrelations
1.00
37.2 0.75
0.50
37.0
0.25
Values
ACF
36.8 0.00
0 10 20 30 40 50
-0.25
36.6 Lag
-0.50
36.4 -0.75
-1.00
20 40 60 80 100
Time
0.25
Variance
15
PACF
0.00
0 10 20 30 40 50 10
-0.25
Lag
-0.50
5
-0.75
-1.00 0
0.0 0.1 0.2 0.3 0.4 0.5
Frequency
8
Statistical Advisory & Training Service Pty Ltd
36.33 36.34 36.35 36.42 36.55 36.69 36.71 36.75 36.81 36.88
36.89 36.91 36.85 36.89 36.89 36.67 36.50 36.74 36.77 36.76
36.78 36.82 36.89 36.99 36.92 36.99 36.89 36.94 36.92 36.97
36.91 36.79 36.77 36.69 36.62 36.54 36.55 36.67 36.69 36.62
36.64 36.59 36.65 36.75 36.80 36.81 36.87 36.87 36.89 36.94
36.98 36.95 37.00 37.07 37.05 37.00 36.95 37.00 36.94 36.88
36.93 36.98 36.97 36.85 36.92 36.99 37.01 37.10 37.09 37.02
36.96 36.84 36.87 36.85 36.85 36.87 36.89 36.86 36.91 37.53
37.23 37.20 * 37.25 37.20 37.21 37.24 37.10 37.20 37.18
36.93 36.83 36.93 36.83 36.80 36.75 36.71 36.73 36.75 36.72
36.76 36.70 36.82 36.88 36.94 36.79 36.78 36.80 36.82 36.84
36.86 36.88 36.93 36.97 37.15
There are various ways that we can model this correlation structure. In time series literature,
they define autoregressive (AR) models, moving average (MA) models, combinations of
these known as ARMA models for data, or ARIMA models for differences in data values.
For the beaver data and the random temperature data, the ACF and PACF values are obtained
as follows. Select Time Series > Data Exploration and the data to be investigated. In Options,
9
Statistical Advisory & Training Service Pty Ltd
choose Partial Autocorrelation Functions if these are required. The default should include
ACF and PACF plots.
ACF and PACF plots for beaver temperatures and random temperatures are given on the left
hand page for the first twenty lags. The horizontal lines on each plot are confidence bands
around zero values.
There is clearly a difference. For the beaver data, the ACF declines steadily while the PACF
values are basically zero (note that, by definition, lag-1 correlations are unity). For the
random data, both ACF and PACF functions are zero.
In this manual we will mention three correlation structures that are commonly used in
biological sciences.
This model says that the correlation between two data values is the same irrespective of the
time or distance between them.
A uniform correlation structure applies, for example, whenever blocks are assumed random
in a randomized block design. This means that the yields in a block are all uniformly
correlated – which often is less than satisfactory. More likely, plots closer together are more
highly correlated than plots far apart.
It is the only correlation structure that allows a split-plot ANOVA to be used validly for units
in an experiment that are repeatedly measured in time.
This model says that the correlation between two data values declines exponentially with the
time or distance between them. When time intervals or distances between plots are equal, the
model is described as an AR1 model with correlations ρ, ρ2, ρ3, ρ4, …. The power model is
more general, with a correlation of ρs between observations s units apart – the units can be
unequally spaced.
The observation at time t is linearly related to that at time t-1 –this is a lag 1 process
10
Statistical Advisory & Training Service Pty Ltd
1 & &
&. &/
$& 1 & &
&. ,
#&
& 1 & &
⋯ +
The AR1 correlation matrix looks like #&. &
& 1 & +
# / +
#& &. &
& 1 +
⋮ ⋱ ⋮
" ⋯ *
The beaver data appears to follow an AR1 process, since the pattern of autocorrelations is
(approximately) 0.8, 0.82=0.64, 0.83=0.51, 0.84=0.41, 0.85=0.33, 0.82=0. 26, …. The actual
pattern is 0.8, 0.66, 0.53, 0.46, 0.35, 0.25, ….
For this process the dependent error depends only on the previous two dependent errors:
The observation at time t depends only on the previous two observations, those at time t-1
and at time t-2.
The formulae for the higher-lag correlations in the AR2 correlation matrix become more
complex. Suffice to say that the AR2 sequence ρ, ρ2, ρ3, ρ4, … declines somewhat faster than
the AR1 sequence ρ, ρ2, ρ3, ρ4, ….
Generally we do not have a long run of correlated data, so time series devices that assist us to
choose the most appropriate correlation model are unavailable.
Since correlations are some of the parameters of the random effects, we can use change in
deviance to test whether some are zero or not.
We cannot compare uniform and AR1 models, since no value of ρ in the AR1 structure leads
to a uniform correlation matrix. However, since a minimum deviance is associated with a
maximum likelihood, the model having the smaller deviance is worth exploring. Generally,
we support the choice by an investigation of the residuals: if the chosen model is appropriate,
there should be no remaining trend in the residuals.
11
Statistical Advisory & Training Service Pty Ltd
_erp ARIMA - 1 0 0 1
Parameter estimates
Model Seas. Diff. Delay Parameter Lag Ref Estimate s.e. t
Period Order
Noise 1 0 - Constant - 1 36.8489 0.0826 446.26
Phi (AR) 1 2 0.8968 0.0473 18.96
Assume an AR1 stationary model for temperature. We can use change in deviance to test this
model, namely
Note that the estimates will be slightly different than those obtained using GenStat’s Time
Series menu. LMM (REML) used REML rather than ML to estimate the variance parameters.
For the independent model, we leave the Fixed Model blank (there is no predictor variate, just
an overall mean which GenStat adds automatically). The Random Model consists of a factor
to identify the n units, so we could set up our own Observation factor (with n = 115 levels), or
just use the in-built ‘*Units*’, or just leave it blank (since GenStat will add an independent
error term for us). However, in order to set up a correlation structure later, we will add
Observation at this stage.
For the dependent model, we again leave the Fixed Model blank (there is still no predictor
variate). The Random Model consists of a factor to identify the dependent units ε*t −1 ; we use
the factor Observation and declare an AR1 structure for this. Note that we could also set an
AR2 structure (which assumes that the temperature at time t depends directly on the previous
two temperatures) and test whether this more complex model is statistically better than the
AR1 model. Unfortunately for this example the mathematical algorithm does not converge
for the AR2 model.
12
Statistical Advisory & Training Service Pty Ltd
The deviances for the two models are as follows. Clearly the AR1 model is superior to the
independent error model.
To maximize the explanation in GenStat’s output we also use click Covariance Model in the
LMM (REML) Options.
13
Statistical Advisory & Training Service Pty Ltd
G is a single matrix
Scalar Sigma2*g: 0.06575
Factor: Observation
Model : Auto-regressive
Deviance: -2*Log-Likelihood
Deviance d.f.
-411.23 110
The REML estimate of ρ (or φ1 – labeled phi_1 in the output) is 0.9337; the ML time
series estimate was 0.8968. Thus, the AR1 model assumes that the correlations between
the temperatures are (0.9337)2 = 0.872 for two units of time apart, (0.9337)3 = 0.814 for
three units of time apart, (0.9337)4 = 0.760 for four units of time apart, (0.9337)5 = 0.710
14
Statistical Advisory & Training Service Pty Ltd
for five units of time apart, and so on. These values form the covariance matrix printed
above.
The scalar 113.4 is multiplied by the “variance estimate” 0.000580 giving 0.066 as the
REML estimate of the variance of any temperature at a particular time point. This is
confirmed in the output (Scalar Sigma2*g: 0.06575). This is the variance of the dependent
error term in the model.
In the time series output, this needs to be reconstructed from the properties of the time
series. For the assumptions to work, the “innovative variance”, i.e. the variance of the
independent error component, turns out to be:
Hence
Thus, the temperature at time t is approximately 2.444°C + 0.9337 times the temperature
at time t-1.
15
Statistical Advisory & Training Service Pty Ltd
or as
Notice that this model is in the form mean + fixed effect + random effect. The assumptions
made when using a regression ANOVA (independent normally distributed errors with
constant variance) fit within a LMM (REML) framework, and hence the analyses should be
identical.
It is the second form of the model that GenStat has as the default in its LMM (REML) menu.
To obtain the first form, go into Options and untick Covariates Centred to Zero Mean. You
should also click Deviance and, for regression, the Estimated Effects (that is, mean Y and
slope, or intercept and slope respectively).
As always, '*Units*'
can be ignored (a
residual term is
added in anyway)
unless you need to
correlate the error
terms.
16
Statistical Advisory & Training Service Pty Ltd
Regression analysis
Response variate: Yield
Fitted terms: Constant, Amount
Summary of analysis
Source d.f. s.s. m.s. v.r. F pr.
Regression 1 0.70312 0.703125 82.00 0.012
Residual 2 0.01715 0.008575
Total 3 0.72028 0.240092
Estimates of parameters
Parameter estimate s.e. t(2) t pr.
Constant 8.4100 0.0775 108.55 <.001
Amount 0.0938 0.0104 9.06 0.012
Deviance: -2*Log-Likelihood
Deviance d.f.
-1.75 1
17
Statistical Advisory & Training Service Pty Ltd
So LMM (REML):
produces the same F statistic (82.00) as regression produces for the ANOVA(called v.r.
in that analysis);
The mean amount of fertilizer (6.0) is not part of the REML output, it needs to be calculated
separately.
18
Statistical Advisory & Training Service Pty Ltd
Example 4 Coefficients of digestibility of dry matter, of sheep and steers fed corn silage,
in percent (Steel and Torrie, page 93)
Sheep Steers
57.8 64.2
56.2 58.7
61.9 63.1
54.4 62.5
53.6 59.8
56.4 59.2
53.2
mean 56.21 61.25
sd 3.00 2.83
If the test does not fail, then the unpaired t test is used to test the means, with
s 2p + and df = ( n1 − 1) + ( n2 − 1) . Here, 01
is a weighted average of the two
1 1
sed =
n1 n2
treatment variances (see Appendix).
If the test does fail, then an approximate t test is used to test the
s12 s22
2
s12 s22
means, with sed = + . The degrees of freedom are +
n1 n2 n1 n2
df =
( s1 n1 ) ( s2 n2 )
2 2 2 2
calculated from the formula alongside; if the two sample variances
are close, the approximate df are close to (n1-1)+(n2-1). When the n −1 + n −1
two sample variances are different, the approximate df will be 1 2
closer to the df associated with the larger variance.
To analyse the data, use Stats > Statistical Tests > One- and two-sample t-tests…. GenStat
allows the data to be organized either in separate columns for the separate treatments, or in
one combined data column plus a factor column to identify which observation each treatment
belongs to. Since this is a special case of a more general design, we chose to illustrate the
latter approach, see the output on the left hand page.
Two-sample t-test
Variate: Digestibility
Group factor: Treatment Step 1. GenStat tests
H0: σ12 = σ 22 using F= s12 / s22 .
Test for equality of sample variances
Here there is no evidence that the
Test statistic F = 1.70 on 6 and 5 d.f. population variances are not equal
Probability (under null hypothesis of equal variances) = 0.58 (P=0.580).
Summary
Standard Standard error
Sample Size Mean Variance deviation of mean
Sheep 7 56.21 9.015 3.002 1.135
Steers 6 61.25 5.299 2.302 0.940
20
Statistical Advisory & Training Service Pty Ltd
Apart from individual random errors, the only possible differences in the data can come from
individual treatment effects, leading to a model
With t treatments, there can only be t-1 treatment effects in a model that contains an overall
mean: the effects measure how far a particular treatment is from the overall mean. Note that
the general regression model allows factors as explanatory variates. ANOVA is therefore just
a special case of multiple linear regression. However, the model is also a special case of a
LMM, and hence the t-test can be performed using ANOVA, regression or LMM (REML).
Regression output
Here is GenStat’s output from Stats > Regression Analysis > Linear Models and choosing
General Linear Regression from the drop down selection. The model is referenced to level 1
(Sheep), hence Constant is the estimate of the Sheep mean. The coefficient Treatment Steers is
what you add to the Constant to obtain the mean for the second level (Steers) and hence is the
difference in means (Steers-Sheep).
Regression analysis
Response variate: Digestibility
Fitted terms: Constant, Treatment
Summary of analysis
Source d.f. s.s. m.s. v.r. F pr. Same P-value as
Regression 1 81.93 81.927 11.18 0.007 that for t test of
Residual 11 80.58 7.326 means
Total 12 162.51 13.543
Message: the following units have large standardized residuals. 7.326 is the
Unit Response Residual pooled estimate
3 61.90 2.27
of variance
Estimates of parameters Constant is mean
Parameter estimate s.e. t(11) t pr.
Constant 56.21 1.02 54.95 <.001 for level 1 Sheep
Treatment Steers 5.04 1.51 3.34 0.007
Difference in
Parameters for factors are differences compared with the reference level: means is 5.04
Factor Reference level
Treatment Sheep
sem = 1.02 for
Sheep
sed = 1.51
21
Statistical Advisory & Training Service Pty Ltd
Use Stats > Analysis of Variance. There is a special menu item for this design, but we prefer
to use the General analysis of variance. We have also gone into Options and selected l.s.d.s.
Without changing the stacked spreadsheet, the output is as follows.
Analysis of variance
Variate: Digestibility
Tables of means
Grand mean 58.73
This is not exactly the same analysis, because with unequally replicated treatments, if you
leave a row in with an asterisk (*) to signify a missing value, GenStat assumes you want to
estimate the missing value. This is rather an old fashioned approach. It over-estimates the
Treatment SS and the resulting variance ratio is therefore too large.
If you really do have missing values, there is an Unbalanced Treatment Structure you can use
in this case. (Basically, GenStat analyses the data via regression for you.)
If this is a case of a deliberate choice of sample size (for example, these are the only steers
you could get hold of), then a correct analysis is obtained after deleting the row with the *.
22
Statistical Advisory & Training Service Pty Ltd
(i) Including the row with the missing value, choosing Unbalanced Treatment
Structure
Analysis of an unbalanced design using GenStat regression
Accumulated analysis of variance
Change d.f. s.s. m.s. v.r. F pr.
+ Treatment 1 81.927 81.927 11.18 0.007
Residual 11 80.584 7.326
Total 12 162.511 13.543
(ii) Deleting the row with the non-observed value, choosing General Analysis of
Variance
Analysis of variance
Variate: Digestibility
Tables of means
Grand mean 58.54
23
Statistical Advisory & Training Service Pty Ltd
The Fixed Model is again Treatment. Since there is only one random error term we can ignore
the Random Model, since as always GenStat allows us to omit the error in the final stratum –
it adds it in for us. Tick to obtain deviances and predicted means. From Version 11 l.s.d.
values can be selected as well. Missing values are ignored, as in regression, so the * that may
be in the stacked dataset is simply ignored.
Deviance: -2*Log-Likelihood
Deviance d.f.
36.64 10
24
Statistical Advisory & Training Service Pty Ltd
Notice that regression, LMM (REML) and ANOVA (except with the missing unit retained)
analyses give virtually the same information as the t test did. We obtained:
the same P-value for testing the difference between the two means (0.007);
the same estimate of variance (7.326) and hence the same s.e.d. value (1.506);
An advantage to the t test is the calculation of the confidence interval for treatment mean
difference (µsteers-µsheep). With the other approaches you need to add and subtract the l.s.d.
value (3.314) to the mean difference (61.25-56.21) to obtain the confidence interval. Another
advantage is the default automatic check on equality of treatment variances, which is a very
important assumption underlying ANOVA. We will demonstrate how to do this in LMM
(REML) with the next example.
An advantage to the ANOVA approach is that unusual values (ie standardized residuals
outside the range (-2, +2)) are flagged. It is also important to routinely examine
(standardized) residual plots.
25
Statistical Advisory & Training Service Pty Ltd
Example 5 Fine gravel in soil, in percent (Steel and Torrie, page 107)
Residuals
0.5
18.2 6.5 3
0.0
16.1 4.1 2
-0.5
7.6 4.7
1 -1.0
mean 10.91 3.94 -1.5
variance 40.12 6.95 0
-2 -1 0 1 2 4 5 6 7 8 9 10 11
Fitted values
Both means and variances in the
two samples appear to be Normal plot Half-Normal plot
different. What statistical 1.5 1.6
-0.5 0.6
We first analysed the data via a 0.4
-1.0
one-way (no blocking) analysis 0.2
-1.5
of variance, and examined the 0.0
residual plot. It is clear that the -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 0.00 0.25 0.50 0.75 1.00 1.25 1.50 1.75 2.00
Expected Normal quantiles Expected Normal quantiles
soil with the higher fitted value
(obviously the good soil) has a
larger visual scatter of residuals compared to that for the poor soil. This is a reflection of the
different variances in the two samples.
An analysis in GenStat via a t test results in strong statistical evidence (P = 0.020) that the
mean percentages of fine gravel differ. However, the test of equal variances is marginal.
GenStat actually proceeds to use the standard unpaired t test because technically the F test
does not fail (P = 0.05 to two decimals; it is actually 0.0509). We make three points.
The F test depends heavily on normally distributed data, and percentages are unlikely to
be normally distributed, so the P-value is somewhat unreliable.
Failure to reject in this case is most likely to be caused by the low level of replication.
We often make decisions about homogeneity of variance in more complex analyses of
variance from an inspection of the standardized residual plot, rather than a formal test.
As mentioned previously, the default in GenStat for this test is to allow it to decide
automatically what test to use for the means. To illustrate the approximate procedure, we
over-rode GenStat by going into the Options menu, as shown. The change for an equally
replicated experiment is only in the df of the t test (and hence in the P-value). Remember, it is
not an exact t test. Here, the df used are obtained from the Satterthaite formula and are closer
to 6 than to 12, since the variances are quite different in the sample.
26
Statistical Advisory & Training Service Pty Ltd
GenStat output for the automatic t test of the fine gravel data
Two-sample t-test
Variate: Fine_gravel
Group factor: Soil
Summary
Standard Standard error
Sample Size Mean Variance deviation of mean
good 7 10.914 40.12 6.334 2.394
poor 7 3.943 6.95 2.636 0.996
There are two competing hypotheses as far as variances are concerned. The first is that the
variance of the good soil is equal to that of the poor soil. The alternative is that they are
different. Since these are parameters in the random part of the model, we test equality by
change in deviance.
In order to actually access the Correlated Error Terms sub-menu, we need to enter the residual
term ourselves. As always, the residual term must be a factor that indexes over all the data, in
such a way as the factor Soil is present. Then we can set the levels of that factor to have a
Diagonal variance matrix. We therefore need to set up a Replicate factor to index over the 7
replicates of each of good and poor soil:
28
Statistical Advisory & Training Service Pty Ltd
We run the analysis twice, once with Identity and once with Diagonal and record the deviance
information:
Here, the change in deviance is based on an asymptotic χ2 distribution, not the F distribution.
Since we have significance at 5%, we use the unequal variance output.
Replicate Identity - - -
Soil Diagonal d_1 40.12 23.17
d_2 6.950 4.012
Tests for fixed effects The F statistic is identical to the square of the
Satterthwaite t test obtained earlier:
Sequentially adding terms to fixed model Test statistic t = 2.69 on approximately 8.02 d.f.
Fixed term Wald statistic n.d.f. F statistic d.d.f. F pr
Soil 7.23 1 7.23 8.0 0.028
29
Statistical Advisory & Training Service Pty Ltd
Soil Good_soil 1 *
Soil Poor_soil 2 5.980 * Appropriate l.s.d. value
1 2
Note. If GenStat produces a Sigma2 value that is not unity, then d_1 will be 1.000 and d_2 a
multiplier different to 1.000. These are GenStat’s gamma (multiplier) values. The Sigma
parameterization is easily obtained by capturing the REML line, copying it to a new Input
window and modifying the PARAMETERIZATION option:
30
Statistical Advisory & Training Service Pty Ltd
Paired t test – special case of a one-way treatment design (in randomised blocks)
Example 6 Sugar concentrations of nectar in half heads of red clover kept at different
vapor pressures for eight hours (from Steel and Torrie, page 103)
This example is quite different to the previous two examples. In this case, we cannot place
the 10 concentrations in any order in each column: they are paired. The heads of red clover
are divided into half heads; one is randomly subjected to a vapor pressure of 4.4 mm Hg, the
other to a vapor pressure of 9.9 mm Hg. Each head of clover is likely to vary in its sugar
concentration, and the only way to remove this variation is to take differences, and analyse
these in a one sample t test.
When we have more than two treatments in an experiment that is blocked in some way, then
we need to analyse the data using an ANOVA F test, setting up a “block” factor as well as a
“treatment” factor.
Firstly, in GenStat, paired t test data must be set up in separate columns for separate
treatments.
As a paired t test
31
Statistical Advisory & Training Service Pty Ltd
One-sample t-test
Variate: Y[1].
Standard Standard error
Sample Size Mean Variance deviation of mean
VP_4_4-VP_9_9 10 10.89 4.914 2.217 0.7010
There is strong statistical evidence (P<0.001) that the mean sugar concentration of nectar
differs in heads of red clover kept at different vapor pressures for eight hours. The best
estimated mean difference is 10.89%, and we are 95% confident that the true difference lies
between 9.30% and 12.48%.
To analyse the data via ANOVA or regression, we must stack the data, and provide a factor
column to identify the various head (acting as blocks).
Notice in the output that GenStat organizes the ANOVA into the two strata for this
experiment. Individual heads form the top stratum, and since these are not replicated (there is
no other “head 1” or “head 2” etc), there is no P-value for this variance ratio. The second
stratum is the “Heads.Units” stratum, that is, the half head put into one of two vapor pressure
treatments (at random). These are replicated in a balanced way (each treatment occurs once in
each block).
32
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Concentration
Head.*Units* stratum
Vapor_Pressure 1 592.960 592.960 241.32 <.001
Residual 9 22.115 2.457
Total 19 731.189
Tables of means
Variate: Concentration
Again, notice
the relationship between the t-value of 15.53, and the F-value of 241.32 (15.532= 241.32);
the same P-value (P<0.001, though it is hard to see the similarity, P is so small;
the mean difference is 67.04 - 56.15 = 10.89 ± 1.586, giving rise to the same confidence
interval.
33
Statistical Advisory & Training Service Pty Ltd
Regression output
Remember that a t test is just a special case of regression. There are two models to consider
when testing whether the vapor pressure treatment effect is zero.
Maximal model
Sugar concentration = overall mean + Head effect + Vapor pressure effect + Error
dropped
Reduced model
Sugar concentration = overall mean + Head effect + Error
Technically you need to run both models. The best estimate of error variance is obtained as
the Residual MS from the ANOVA of the maximal model. The effect of treatments over and
above that of blocks is obtained by subtracting the residual sums of squares from the two
ANOVAs; divide this by the change in degrees of freedom to obtain the Treatment MS. The
variance ratio is constructed as the ratio of the Treatment MS and Residual MS from the
maximal model.
In GenStat’s General Linear Regression Option menu, the effect of blocks (Heads) and
treatments (vapor pressure) can be assessed by turning on Accumulated.
Via regression
Regression analysis
Response variate: Concentration
Fitted terms: Constant + Head + Vapor_Pressure
Summary of analysis
Source d.f. s.s. m.s. v.r. F pr.
Regression 10 709.08 70.908 28.86 <.001
Residual 9 22.11 2.457
Total 19 731.19 38.484
34
Statistical Advisory & Training Service Pty Ltd
Estimates of parameters
Parameter estimate s.e. t(9) t pr.
Constant 62.55 1.16 53.80 <.001
Head 2 2.60 1.57 1.66 0.132
Head 3 3.35 1.57 2.14 0.061
Head 4 6.35 1.57 4.05 0.003
Head 5 5.80 1.57 3.70 0.005
Head 6 8.70 1.57 5.55 <.001
Head 7 5.40 1.57 3.44 0.007
Head 8 4.50 1.57 2.87 0.018
Head 9 6.25 1.57 3.99 0.003
Head 10 2.00 1.57 1.28 0.234
Vapor_Pressure 9.900 -10.890 0.701 -15.53 <.001
Parameters for factors are differences compared with the reference level:
Factor Reference level
Head 1
Vapor_Pressure 4.400
The default model produces a Constant (the mean for vapor pressure 4.4) and a mean
difference of -10.890, labeled Vapor_Pressure 9.900. This is highly significant, with a t-value
of -15.53, the same (apart from sign) as was produced by the paired t test. The Accumulated
analysis is the RCBD ANOVA, though it is an application of the general technique for
comparing a maximal and reduced model.
Notice also that 1.16 is actually the s.e.m. and 0.701 the s.e.d..
Blocks in a field experiment are almost always treated as random factors, although it makes
no difference to the test of treatment means whether it is treated as fixed or random – we will
demonstrate this property later.
In this case, the factor Head is almost certainly a random factor: heads were chosen from a
large number of heads, at random. GenStat assumed it to be random in the ANOVA output,
producing variance components for the Head stratum as well as the Heads.Units stratum:
35
Statistical Advisory & Training Service Pty Ltd
Vapour_pressure
Vapour_pressure %4_4_mm_Hg 1 *
Vapour_pressure %9_9_mm_Hg 2 1.586
1 2
36
Statistical Advisory & Training Service Pty Ltd
The data are from an experiment in plant physiology. Lengths of pea sections grown in tissue
culture with auxin present were recorded. The purpose of the experiment was to test the
effects of various sugar media on growth as measured by length.
Treatment structure: Single factor with 5 levels: sugar treatments (including a control)
Block Structure: None: 10 replicates for all treatments
Example 7 The effect of different sugars on length, in ocular units ( × 0.114 = mm), of
pea sections grown in tissue culture with auxin present (Sokal & Rohlf 3rd Ed.
page 218)
In this experiment we have 50 pots (labelled 1 to 50) with no blocking required. The pots are
placed in a growth chamber, and the treatments randomized to the pots (eg using GenStat’s
Design menu; notice that GenStat creates a factor column Pots, with levels 1 to 50):
1 2 3 4 5
Control Control
6 7 8 9 10
Control Control
11 12 13 14 15
Control
16 17 18 19 20
Control Control
21 22 23 24 25
Control
26 27 28 29 30
Control
31 32 33 34 35
36 37 38 39 40
41 42 43 44 45
Pots are numbered 1 to 50. Random Control
allocation of the Control treatment is 46 47 48 49 50
shown
37
Statistical Advisory & Training Service Pty Ltd
Choose One- and Two-way to obtain the basic CRD ANOVA; alternatively, choose General
Analysis of Variance and use Pots as the Block Structure. Note that GenStat allows the final
stratum to be omitted, so you can, for this design, leave the Block Structure blank. Notice that
we selected to output the 5% l.s.d. values. The s.e.(difference) is set as the default output; we
could also have chosen to obtain the s.e.(mean). The (standardised) residual plot can be
drawn once the analysis is obtained: return to the Analysis of Variance window, select Further
Output, Residual Plots and Standardized.
38
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Length
Tables of means
Variate: Length
Notice:
5.456 is the average of the sample variances 15.878, 2.678, 3.511, 2.000, 3.211, each with
(10-1) = 9 df.
269.33 is the weighted sample variance of the sugar means 70.1, 59.3, 58.2, 58.0, 64.1.
Since an unweighted variance would (if the population treatment means were all equal)
estimate σ2/10, the Sugar MS is 10 × sample variance.
Before discussing the analysis in any more detail, we should inspect the (standardized)
residual plot.
39
Statistical Advisory & Training Service Pty Ltd
12 1
treatment. This is common in agricultural
Residuals
10
6
analysing the data. 4
-1
2 -2
Residuals
mean2. 0
1.5
1.0
-1
In this case, untreated data simply behave 0.5
Alternatively, a Linear Mixed Model can be used that allows two variances, one for untreated
data and another for treated data. Both tests (tests of equality of the four sugar treatment
means, test of the mean of the untreated data versus the mean of the treated data) are done in
the one analysis.
40
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Length
Tables of means
Grand mean 59.90
To compare the Control mean (which has an estimated standard deviation of s1 = 3.985 with 9
df) with one of the 4 sugar means (which has an estimated standard deviation of sp = 2.850
= 1.688 with 36 df) is achieved by an extension of Satterthwaite’s test.
2
s12 s p
Difference in means = 70.1 – 64.1 = 6.0. sed = + = 1.873 = 1.368. Hence,
n1 n2
The degrees of freedom are calculated from a formula modified using the formula on page
34, with n2=10 and n2=40.
s12 s 2p
2
+
1n n2
df = = 12.42.
( 1 1) ( p 2 )
2 2 2 2
s n s n
+
n1 − 1 df of s 2p
There is strong statistical evidence (P<0.001) that the control and sucrose means are
different. The modified df for comparing the control mean against the mean of all 4 sugar
treatments (i.e for n2=40) is 9.82.
41
Statistical Advisory & Training Service Pty Ltd
Firstly, the treatment variances (each with 9 df) fall into two groups. The variance for the
untreated pots (15.878) appears quite different to that for the treated pots. The average
variance for treated pots is 2.850.
Treatment variances
Control glucose 2% fructose 2% gluc_fruct 1% sucrose 2%
15.878 2.678 3.511 2.000 3.211
The Random Model is Pots (a factor with levels 1 to 50). However, this model assumes that
the variance is constant (Identity). We are interested in allowing the variance to change
depending on the treatment.
The worst case is when every treatment has a different variance. What is believed is that only
the Control treatment has a different variance.
for the treated pots, to compare among the four sugar treatments.
The spreadsheet can be set up with a factor (called say Control_Rest) to identify control and
treated pots. We will use the label “control” to identify a control pot and a label “treated” to
identify a treated pot.
Among the treated pots, the four sugar treatments can be compared using GenStat’s nested
shortcut. In other words, the treatment structure is:
The following choices set up difference variance structures among the treatments
Random Model: Pots.Sugar allows a different variance for all 5 sugar treatments
by selecting Diagonal for Sugar in Correlated Error
Terms
Random Model: Pots.Control_Rest sets up one variance for the control treatment, and a
separate variance for the other 4 sugar treatments,
by selecting Diagonal for Control_Rest in Correlated
Error Terms;
Random Model: Pots sets up a constant variance for all 5 treatments by
selecting Identity for Pot in Correlated Error Terms.
42
Statistical Advisory & Training Service Pty Ltd
Note that the default in GenStat is to produce multipliers rather than actual variances when
selecting a Diagonal variance structure. To have GenStat print out the different variance
estimates instead, use the
PARAMETERIZATION=sigmas
option of REML. You will need to run the default model, copy the three lines from the Input
window, add the option and re-run the window.
Change in Change in
Model Random Model Deviance d.f. P value
deviance d.f.
All 5 treatment
Pots.Sugar 118.3 40 0.80 3 0.849
variances different
Control variance
Pots.Control_Rest 119.1 43 13.76 1 <0.001
different
Common variance Pots 132.86 44
Clearly allowing the control treatment to have a different variance is a better assumption than
one with all variances equal (P<0.001); it appears unnecessary to allow all five treatments
variances to be different (P=0.849).
Having the Fixed Model as Control_Rest/Sugar allows the comparison of the control treatment
with the remaining sugar treatments to be equivalent to a t test with unequal variances. The
apparent interaction Control_Rest.Sugar is actually a main effect, testing the differences
among the four sugar treatments.
43
Statistical Advisory & Training Service Pty Ltd
Notice that 15.877 is actually the sample variance of the control data, whereas 2.850 is the
average of the four sugar variances, each with 9 df. Hence the variance estimate for the
control data has 9 df, while the average sugar variance has 36 df.
Deviance: -2*Log-Likelihood
Deviance d.f.
119.10 43
44
Statistical Advisory & Training Service Pty Ltd
Since the means have one of two estimated variances, the s.e.d. values will differ depending
on whether a control mean is involved (1.37), or not (0.75). Use the Standard Errors All
Differences option to obtain a complete set of s.e.d and l.s.d. values.
The Wald F statistic and d.f. for the (nested) component Control_Rest.Sugar are the same
as those from th ANOVA of just the treated data:
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Sugar 3 245.000 81.667 28.65 <.001
Residual 36 102.600 2.850
Total 39 347.600
The Wald F statistic and d.f. for the component Control_Sugar_F.Sugar are the same those
from the Satterthwaite approximate t test of the control mean versus the mean of all
treated pots:
15.878 2.850
Difference in means = 10.2, s.e.d. = + = 1.288
10 40
t = 10.2/1.288 = 7.919, or F = t2 = 7.9192 = 62.711 (d.f. calculation shown earlier).
There is an FCONTRASTS procedure (from version 12) that allows you to fit contrasts in
REML by commands. However, we have done this directly in the spreadsheet menu
choosing, by way of illustration:
To set these variates up, each time click in the Sugar factor column and use Spread > Factor >
Recode. We need a variate and hence untick Create as a Factor and tick Recode to Numeric.
Define the new values and name the contrast appropriately, as shown in the following screen
capture:
45
Statistical Advisory & Training Service Pty Ltd
Control_Sugar+GF_G_F+G_F+S_others
The output is the same as before, with individual Wald F statistics for each of the 4 contrasts
instead. The design is balanced, hence test of the sequential terms and dropping each term
last are the same.
46
Statistical Advisory & Training Service Pty Ltd
Prof Roger Payne kindly pointed out a more simple method of obtaining the analysis where
the variance changes across (part of) one or more factors. This menu allows you to specify a
changing variance across different experiments. In this case, we imagine that the control pots
come from a separate experiment than the treated pots.
The Random Model is Pots, since the changing variance is declared in the next line. Pots can
be omitted, as is usual for a simple CRD (since GenStat adds an error term if one is not
provided).
In this case, on the Experiments line simply indicate the factor Control_Sugar_F that
contains the information to identify how the variance changes.
The output is the same as before with the exception of a more simple presentation of the
variance estimates:
47
Statistical Advisory & Training Service Pty Ltd
Mint plants were assigned at random to pots, 4 plants per pot, 18 pots in all and grown in a
nutrient solution. Three pots were randomly assigned to one of six treatment combinations, as
follows. All pots were randomly located during the time spent at either 8, 12 or 16 hours of
daylight. Each group of pots was completely randomized within low- or high-temperature
greenhouses during the time spent in darkness. Individual plants stem lengths were measured
after one week.
Example 8 One week stem lengths (cm, Steel and Torrie pages 153-9)
Temperature
High Low
Hours of Daylight Hours of Daylight
8 12 16 8 12 16
pot pot pot pot Pot pot
1 2 3 1 2 3 1 2 3 1 2 3 1 2 3 1 2 3
3.5 2.5 3.0 5.0 3.5 4.5 5.0 5.5 5.5 8.5 6.5 7.0 6.0 6.0 6.5 7.0 6.0 11.0
4.0 4.5 3.0 5.5 3.5 4.0 4.5 6.0 4.5 6.0 7.0 7.0 5.5 8.5 6.5 9.0 7.0 7.0
3.0 5.5 2.5 4.0 3.0 4.0 5.0 5.0 6.5 9.0 8.0 7.0 3.5 4.5 8.5 8.5 7.0 9.0
4.5 5.0 3.0 3.5 4.0 5.0 4.5 5.0 5.5 8.5 6.5 7.0 7.0 7.5 7.5 8.5 7.0 8.0
This design is slightly complex, in that half the pots have a restricted randomization for the
time spent in one of the two greenhouses, each set at a different temperature. Ignoring that
problem, it is clear that pots form replicates for the six treatment combinations: a pot
containing 4 plants is moved to a random daylight position and a random position in a
greenhouse; the 4 plants form sampling units.
Treatment Structure
You need to supply two factor columns, properly labeled, to identify the six Temperature and
Light treatment combinations applied to each pot. The Treatment Structure is then
Temperature + Light + Temperature.Light. By the Rule 2 simplifies to Temperature*Light.
Block Structure
Choice 1
Generally we recommend that the replicates be numbered from 1 to the total number of
replicates, across all treatments . There are 18 pot replicates, and in our spreadsheet we called
this column Pots. Plants in pots are samples. There are two strata, and hence the Block
Structure is Pots+Pots.Plant. By Rule 3 this simplifies to Pots/Plant. GenStat also allows the
final error term to be omitted, so Pots is also permissible.
48
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Length
Pots stratum
Temperature 1 151.6701 151.6701 70.45 <.001
Light 2 22.2986 11.1493 5.18 0.024
Temperature.Light 2 5.6736 2.8368 1.32 0.304
Residual 12 25.8333 2.1528 2.30
Total 71 255.9132
…
Tests these means
Tables of means
Variate: Length
49
Statistical Advisory & Training Service Pty Ltd
When interpreting this analysis, it is important to interpret the interaction first (for more
complex designs, from highest-order interaction backwards). A two-way interaction tests
whether any change in the response of the plant to temperature is consistent for both high and
low temperatures. Thus, it examines the response to temperature in the following table. The
response is best plotted (Further Output > Means Plot).
Hours of light
Temperature 8 12 16
High 3.67 4.12 5.21
Low 7.33 6.46 7.92
7 variation (P = 0.304).
6 Hence, attention can
5 High focus on the average
4 effect of temperature, as
3 well as the average effect
2 of light. These are
1 known as main effects.
0 Both are strongly
4 8 12 16 20 significant – see the
Hours of daylight ANOVA table.
50
Statistical Advisory & Training Service Pty Ltd
Interest focuses on how much variation is there from plant to plant (the sampling variance) as
opposed to pot to pot variation. Note that each of 6 treatments provides (3-1) = 12 residual df
for estimating σ2.
Estimates of the sampling and experimental variances are obtained by clicking on Stratum
Variances in Options prior torunning the analysis. The output is the following. There is three
times more variation between plants in a pot than between pots.
Finally, below is the standardised residual plot. You can make up your own mind whether the
variation across all sampling units is constant.
Length
Histogram of residuals Fitted-value plot
20
2
15 1
Residuals
0
10
-1
5
-2
0
-3 -2 -1 0 1 2 3 3 4 5 6 7 8 9
Fitted values
2.5
2
2.0
1
Residuals
1.5
0
1.0
-1
0.5
-2
0.0
-2 -1 0 1 2 0.0 0.5 1.0 1.5 2.0 2.5
Expected Normal quantiles Expected Normal quantiles
51
Statistical Advisory & Training Service Pty Ltd
Here is the LMM (REML) analysis. The means are as before and are suppressed in this
output.
Notice:
The variance estimates (and df) are the same as obtained from ANOVA;
The F statistics and P values are the same as those from the ANOVA.
52
Statistical Advisory & Training Service Pty Ltd
Snedecor and Cochran present the yields of cowpea hay (pounds per 1/100 Morgen plot)
from 3 varieties, each grown with 3 row spacings (4”, 8” and 12” apart).
Firstly, let’s use GenStat’s Design menu to generate a field plan (the monograph does not
give us a field layout). One random design is the following:
Note that spacing experiments, by definition, are unlikely to produce plot mean (or plot total)
yields whose variances are constant. Why is that?
53
Statistical Advisory & Training Service Pty Ltd
From statistical theory, if you add independent variates whose individual variances are the
same, the variance of the sum is the sum of the individual variances. Let σ2 be the variance
on a per plant basis. Then, for independently growing plants,
Now put that in the context of this spacing experiment. The plot area is 0.01 Morgen which is
about 86 m2. Spacings are about 10, 20, 30 cm. The number of rows of varying shapes
depends on the shape of the plot. We’ll assume for illustration that we have multiples of 1.2m
areas for rows. The 12” spacing is equivalent to 30cm row spacing, so 4 rows are used at that
spacing, 6 rows at 20cm spacing and 12 rows at 10cm spacing.
54
Statistical Advisory & Training Service Pty Ltd
Plots like these (with row spacings 12”, 8”, 4”) consist of varying numbers of plants (in the
ratio 4:6:12). Other combinations are possible. The point is, total yield (or mean yield)
obtained from plots with varying numbers of plants will have changing variance if the plants
grow independently.
With plant competition, the variance of total yield could well even out across all shaped plots.
Plant competition means that the yields become spatially correlated. We will ignore this
problem for the moment. Changing variance and correlated yield models are available in
Linear Mixed Models (REML).
Example 9 Yields (pounds) of cowpea hay from Snedecor and Cochran, page 309.
There are two strata in this experiment, Block and Block.Plot. The Block Structure is therefore
Block + Block.Plot, or simply Block/Plot. Since the smallest stratum can be omitted, Block is
sufficient.
The full analysis of the data, including L.S.D. values and stratum variances, is as follows.
55
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Yield
Block.*Units* stratum
Variety 2 1027.39 513.69 29.07 <.001
Spacing 2 155.06 77.53 4.39 0.024
Variety.Spacing 4 765.44 191.36 10.83 <.001
Residual 24 424.11 17.67
Total 35 2627.64
Tables of means
Variate: Yield
Variety 1 2 3
51.33 57.67 64.42
Spacing 4. 8. 12.
55.25 57.83 60.33
There is strong statistical evidence (P<0.001) that the change in mean yield at different row
spacings is not the same for all three varieties. A means plot illuminates the differences:
56
Statistical Advisory & Training Service Pty Ltd
70
65
60
55
50
4 8 12
Spacing
There is a strong linear trend in mean yield,
but the means for variety 2 decrease with 1
increasing spacing. Varieties 1 and 3 must 2
3
have heavy vegetative growth that requires bar
We are also interested in sub-hypotheses for the Variety factor. In this case, two are more
natural than other choices:
H0: Variety 1 and Variety 3 means are equal: we wish to assess µ3-µ1.
H0: Variety 2 mean and the average mean of Variety 1 and Variety 3 are equal: we wish
to assess (µ3+µ1)/2-µ2.
57
Statistical Advisory & Training Service Pty Ltd
Contrasts are simply the coefficients of the means in the questions asked. For any contrast,
the coefficients will add to zero. GenStat allows two types of questions, labelled
Comparisons and Regression.
For t treatments, Regression allows up to (t-1) questions, with restrictions on the questions
asked. The questions must be orthogonal, that is, balanced in a special way. The component
sums of squares for all (t-1) contrasts will add to the Treatment SS. Even if the contrasts are
orthogonal, the Comparisons choice can be used. The only difference is that GenStat does not
report deviations when Comparisons is selected.
Variety 1 vs 3: µ3-µ1 is equivalent to (-1, 0 ,1) multipliers of (µ1, µ2, µ3) respectively
Variety 1&3 vs 2: (µ3+µ1)/2-µ2 is equivalent to (½, -1, ½) multipliers of (µ1, µ2, µ3). It is
preferable to enter integers rather than fractions, so multiplier by a constant (in this case
2) to remove fractions. The contrast is then (1, -2, 1)
Click on the Contrast button, select the Variety factor and nominate Regression and enter the
Number of Contrasts you wish to make (here 2). GenStat opens up a table (which is names,
by default, Cont, or Cont_1 if Cont exists) with (here) 2 rows (questions) and 3 columns
(levels). Names of the levels are placed above the columns. Enter the contrast coefficients,
and double click on the grey areas of the rows, where the names of each contrast can be set
up. Then return to the ANOVA Contrasts menu and click OK. GenStat replaces Variety in the
treatment structure with REG(Variety;2;Cont) or COMP(Variety;2;Cont) if you chose
Comparisons.
58
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Yield
Block.*Units* stratum
Variety 2 1027.39 513.69 29.07 <.001
Var 1 vs 3 1 1027.04 1027.04 58.12 <.001
Var 1,3 vs 2 1 0.35 0.35 0.02 0.890
Spacing 2 155.06 77.53 4.39 0.024
Lin 1 155.04 155.04 8.77 0.007
Deviations 1 0.01 0.01 0.00 0.978
Variety.Spacing 4 765.44 191.36 10.83 <.001
Var 1 vs 3.Lin 1 76.56 76.56 4.33 0.048
Var 1,3 vs 2.Lin 1 682.52 682.52 38.62 <.001
Var 1 vs 3.Dev 1 0.52 0.52 0.03 0.865
Var 1,3 vs 2. Dev 1 5.84 5.84 0.33 0.571
Residual 24 424.11 17.67
Total 35 2627.64
Note that with 3 spacing levels, Dev is identical to the quadratic term. With 4 spacing levels
and a linear model requested, Dev will be the combined quadratic and cubic components: it’s
what is left after the requested polynomial is fitted. This table adds the following to what we
knew already. The slope in the regression of the means of varieties 1 and 3 are marginally
different (P=0.048), whereas the slope for variety 2 in comparison is strikingly different
(P<0.001) to an average slope for variety 1 and 3 means.
75
y = 2.125x + 47.417
70
65
Variety 2
Mean yield
60 y = -1.25x + 67.667
Variety 3
55
50 y = 1.0313x + 43.083
Variety 1
45
40
0 4 8 12
Spacing (inches)
59
Statistical Advisory & Training Service Pty Ltd
If we just wish to estimate the fitted regressions using GenStat, it is easier to use a general
regression ignoring blocks (because the design is orthogonal). The factor column Spacing
needs to be converted to a variate instead (simply point to the column, right click and select
Convert to Variate). The Model to be fitted is Variety*Spacing. We are using this model simply
to obtain the linear equations, not to test hypotheses.
Estimates of parameters
Parameter estimate s.e. t(30) t pr.
Constant 43.08 3.65 11.80 <.001
Spacing 1.031 0.423 2.44 0.021
Variety 2 24.58 5.17 4.76 <.001
Variety 3 4.33 5.17 0.84 0.408
Spacing.Variety 2 -2.281 0.598 -3.82 <.001
Spacing.Variety 3 1.094 0.598 1.83 0.077
Parameters for factors are differences compared with the reference level:
Factor Reference level
Variety 1
For variety 2 we add 24.58 to the intercept and -2.281 to the slope:
Mean yield = 67.66 - 1.250 Spacing
For variety 3 we add 4.33 to the intercept and 1.094 to the slope:
Mean yield = 47.41 + 2.125 Spacing
The Treatment Structure is Spacing*Variety and the Block Structure is Block/Plot. In the earlier
discussion, there was consideration about whether the variance was constant, proportional to
the number of plants in a plot, or somewhere in between. We explore these issues using
change in deviance.
In order to allow a changing variance model for different spacings, we need to ensure that
Spacing appears in the Block Structure so we can use Correlated Error Terms. We can change
Block/Plot for an expression in which the Plot part is replaced by a factor expression which
ranges over the same set of values. Plot goes from 1 to 9 in each block. These track which
combination of variety and spacing is used in each plot. Hence an equivalent expression for
the Block Structure is Block.Spacing.Variety. The deviances for common variance (Identity) and
variances changing over Spacing levels (Diagonal) are as follows:
60
Statistical Advisory & Training Service Pty Ltd
For this experiment, there is no evidence that a changing variance model is necessary
(P=0.504). The rest of the analysis gives the same variance estimates and equivalent test
values as for ANOVA.
We will do this directly by replacing the two factors with variates that represent the contrasts
and trends.
For Variety contrasts, click in the Variety column and use Spread > Factor > Recode. We need
a variate and hence untick Create as a Factor and tick Recode to Numeric. Use the same
contrasts as for ANOVA:
61
Statistical Advisory & Training Service Pty Ltd
For Spacing trends, click in the Spacing column and use Spread > Factor > Recode. There are
spacing levels already defined, so simply untick Create as a Factor and name the new column
S (say). Repeat and use squared spacing levels for a column named S2 (say) representing the
quadratic trend.
Here we are not using orthogonal polynomials for Spacing, and so we need to examine the
Wald statistics sequentially – i.e. we ignore the P Wald statistics in Dropping individual terms
from full fixed model. Each factor in the fixed model Variety*Spacing is replaced by the two
variate contrasts/polynomials, so (Var1_3+Var1_3_2)*(S+S2):
62
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
161.60 25
Illustration that assuming blocks are random does not affect the test of fixed treatments
The tests of fixed effects from a REML analysis with Block a random component are:
Fixed term Wald statistic n.d.f. F statistic d.d.f. F pr
Variety 58.14 2 29.07 24.0 <0.001
Spacing 8.77 2 4.39 24.0 0.024
Variety.Spacing 43.32 4 10.83 24.0 <0.001
F statistics and P values for the two main effects and the interaction are unchanged. In the
second analysis there is an additional test of the fixed block effects. For the first analysis
there is a variance component instead for the random block term.
The means are also unchanged. However, the standard errors of individual means will be
larger for the random block model, since the treatment means all involve an additional
random block term. Standard errors of differences, however, are unchanged, since this block
term cancels out in the difference (assuming a balanced design). Hence decisions based on
comparing means are also unaffected by the assumption about blocks.
63
Statistical Advisory & Training Service Pty Ltd
For example, the standard error of a varietal mean is 1.214 when blocks are assumed fixed,
but 1.830 when they are random; the standard error of a difference is 1.716 in both cases.
Illustration that assuming blocks are random is equivalent to a uniform correlated error
structure
Take any two plots (say plot j and plot k) in block i. The simple RCBD model with fixed
treatments implies
σ2Block
co rr (Yij ,Yik ) = = θ say.
σ2Block + σ 2
The estimated stratum variances from the ANOVA are σ̂ 2Block = 7.505 and σ̂ 2 = 17.671. This
implies that the yields in any two plots in each block are uniformly correlated, the estimated
correlation being 7.505/(7.505+17.671) 0.298.
When you wish to use a correlated error structure in LMM (REML) you need to drop Block
from the Random Model, and use just Block.Plot, since the correlation model supercedes the
two random components model. (This is more fully described on page 656 in GenStat’s
Statistics Guide via the Help screen.)
Unfortunately, Uniform is not currently listed in the menu’s available Correlated Error Terms,
but it is an option in the actual procedure. The way around this is to run a different correlation
structure, copy the appropriate lines of code to a new Input Window, modify the line and re-
run the window of code. Here we chose AR1:
64
Statistical Advisory & Training Service Pty Ltd
To illustrate this, we need to supply an error term that indexes over the 4 blocks and 9 plots in
each block. We will first add a factor column Plot with 9 levels (corresponding to the 3
varieties × 3 spacings used in each block). We then select an AR1 correlated error term from
the menu, copy the input, change AR to uniform and rerun the analysis.
Block Identity - - -
Plot Uniform theta1 0.2981 0.2286
65
Statistical Advisory & Training Service Pty Ltd
There is no random block term in the model, but the presence of a uniform correlation
structure within blocks implies such a term. We can work the formula for the uniform
correlation backwards to calculate the block variance component:
The estimate 25.18 is actually the combined estimate ( σ̂ 2Block + σ̂ 2 ). The uniform correlation is
0.2981 = σ̂ 2Block /( σ̂ 2Block + σ̂ 2 ) = σ̂ 2Block /25.18, so that σ̂ 2Block = 0.2981×25.18 = 7.506 (as was
obtained earlier).
GenStat’s examples in their on-line Statistics guide go even further. Once you start imposing
complex correlation structures on the spatial design, there remains the possibility of including
other sources of variation (measurement error, sampling error etc). Again, we will illustrate
this with the eelworm data.
66
Statistical Advisory & Training Service Pty Ltd
Consider the following factorial treatment structure with two varieties, V, (labelled A, B),
two levels of witchweed, W, (infested, I, or not infested, U) and 4 fertilisers, F, (0 = none,
1 = super only, 2 = super + manure and 4 = super + N + K). Two randomized blocks were
used. The yields, Y, and the field plan are as follows:
Block V W F Y V W F Y V W F Y V W F Y
B I F3 13.5 B U F1 12.8 A I F3 15.8 B I F4 11.6
A I F1 10.4 B U F4 17.1 A I F2 12.5 A U F1 14.8
1
B I F2 11.8 B U F2 16.9 B I F1 9.5 A I F4 11.3
B U F3 22.3 A U F3 24.9 A U F4 19.9 A U F2 19.7
B U F2 16.0 A I F1 10.0 B I F2 9.5 A U F4 19.2
A U F2 18.0 B U F1 13.0 B I F1 9.6 A U F3 22.0
2
B I F3 13.4 A I F4 11.4 B U F4 16.6 B U F3 20.0
A I F2 10.1 B I F4 9.2 A U F1 14.0 A I F3 13.6
This is a straightforward 3-way factorial treatment design. Ignoring any potential problems
with the assumptions, the ANOVA is as follows:
Analysis of variance
Variate: Yield
Block.*Units* stratum
Variety 1 19.2200 19.2200 32.72 <.001
Fertiliser 3 167.7450 55.9150 95.20 <.001
Witchweed 1 338.0000 338.0000 575.48 <.001
Variety.Fertiliser 3 0.7050 0.2350 0.40 0.755
Variety.Witchweed 1 3.6450 3.6450 6.21 0.025
Fertiliser.Witchweed 3 22.2250 7.4083 12.61 <.001
Variety.Fertiliser.Witchweed 3 0.3300 0.1100 0.19 0.903
Residual 15 8.8100 0.5873
Total 31 572.2000
In this case, the 3-factor interaction is not significant so we can turn our attention to 2-factor
interactions. Since the design is balanced, the order of the three 2-way interactions is
67
Statistical Advisory & Training Service Pty Ltd
irrelevant. Below are the P values for a different order (Variety, Witchweed, Fertiliser). You
can see that the variance ratios and P values for the three 2-way interactions are unchanged:
Block.*Units* stratum
Variety 1 19.2200 19.2200 32.72 <.001
Witchweed 1 338.0000 338.0000 575.48 <.001
Fertiliser 3 167.7450 55.9150 95.20 <.001
Variety.Witchweed 1 3.6450 3.6450 6.21 0.025
Variety.Fertiliser 3 0.7050 0.2350 0.40 0.755
Witchweed.Fertiliser 3 22.2250 7.4083 12.61 <.001
Variety.Witchweed.Fertiliser 3 0.3300 0.1100 0.19 0.903
Residual 15 8.8100 0.5873
Now suppose that the bottom right hand corner plot was damaged due to rain. The plot yield,
13.6, is missing. The treatment involved was in a lower yielding block (block 2), the higher
yielding variety A, the highest yielding fertiliser regime and the plot was infested with
witchweed resulting in much lower yields.
We saw with example 1 that using a missing value code in ANOVA had a completely
different outcome than omitting the row completely. With an * in lieu of a data value, a
missing value formula is used to replace the yield, resulting in an apparent balanced data set
(albeit with an adjustment to the residual degrees of freedom). While that may be
approximately OK (treatment F values are somewhat inflated) it could become misleading.
Omitting the entire row and using the unbalanced treatment structure ANOVA produces just
one possible order of the factors and interactions.
In an unbalanced design, it is important to look at the P values for an interaction (or main
effect) adjusted for all other interactions (or main effects) of the same order.
Switching to unbalanced treatment structure ANOVA gives P values for the order of the
factors and interactions in the fixed model:
68
Statistical Advisory & Training Service Pty Ltd
You can see the dilemma: do we trust the 0.041 P value for Variety.Witchweed, or the 0.067 P
value? The answer is we should use the P value for Variety.Witchweed when it is the last 2-
factor interaction entered in the model. The reason is that we need to adjust for the
behaviour of maize across all four fertiliser regimes and both varieties before we can decide
whether the response to infestation of witchweed is the same for the two varieties.
So, since all 2-factor interactions need to be entered last, that means we need to run at least
three different unbalanced treatment structure ANOVAs.
Before looking at how REML handles this, we note the following. Since the 3-factor
interaction is not significant, the corresponding Mean Square must be statistically similar to
the Residual Mean Square (for the variance ratio to be not significantly larger than 1). We
can therefore omit the three-factor interaction from the treatment structure. The repercussion
is to move this interaction into the residual term, thus increasing the precision of the estimate
of variance and increasing the power of the remaining tests.
To remove the three-factor interaction, (i) use the GenStat shortcut A*B*C-A.B.C, or else
simply enumerate the remaining model: A+B+C+A.B+A.C+B.C (or A*B+A*C+B*C since
repeated terms in the expansion of this model are simply ignored), or (ii) simply click Specify
level of interaction in Interaction at the bottom of the REML menu. In this case type 2 for two
factor interactions only, or 1 for main effects only.
69
Statistical Advisory & Training Service Pty Ltd
Remember that REML uses only the data present and hence it makes no difference whether
an * is used or the row deleted entirely.
The Fixed Model is Variety*Witchweed*Fertiliser and the Random Model Block as with
ANOVA:
Notice
GenStat has two sections of tests of fixed effects. The Sequentially adding terms to fixed
model section is equivalent to the order produced by the unbalanced treatment structure
ANOVA, except that with the latter a Block term is included, thereby affecting slightly
the subsequent F values.
The Dropping individual terms from full fixed model section is what should be used with
unbalanced data, since this is where the Wald statistics are placed for each term adjusted
70
Statistical Advisory & Training Service Pty Ltd
In this case, the 3-factor interaction can dropped (P=0.813). When we actually limit the
level of interaction to 2, or drop the three factor interaction from the model and re-run the
analysis using:
Fixed Model: Variety*Fertiliser*Witchweed-Variety.Fertiliser.Witchweed
we obtain:
The P values for each of the 2-factor interactions is obtained adjusted for the other 2-factor
interactions, so it is as if GenStat is running three models for us. Had these interactions all
been not significant we could drop them from the model, leaving main effects only; the Wald
statistics in the Dropping individual terms from full fixed model section are all adjusted.
Any significant interaction that needs to be included in a model should have the main effects
and lower-order interactions included as well.
Thus, we conclude that the final model for this example involves three main effects (variety,
fertliser and witchweed) and two significant interactions Variety.Witchweed (P=0.029) and
Fertliser.Witchweed (P<0.001).
See Appendix 6 for an example showing the reliability of REML means for missing values.
71
Statistical Advisory & Training Service Pty Ltd
McConway et al. (1999) reported the results of an experiment which had a randomised block
design, in more or less the following words. There were 64 plots, arranged in four blocks
each of size sixteen. Each block was a rectangular piece of land, measuring 3m × 32m. Each
block was divided into sixteen plots by splitting the long side of the block into sixteen 2m
pieces. So, each plot was a 3m × 2m rectangle of land. The River Thames runs along one
edge of the field used in this experiment, and usually floods part of the field each year. The
blocks were designed so that the long side of each block was parallel to the river-bank. The
blocks were different distances from the river-bank.
The experiment was about growing turnips for fodder. The turnips would not normally be
harvested because they are grown to provide food for farm animals in winter; the farmer
simply releases animals into the field and the animals graze on the turnips. The turnips are
not even the main crop in the field during the growing season; the turnips are sown after the
main crop is removed.
There were sixteen treatments in this experiment. The combinations are formed from: two
different varieties – Barkant or Marco; two different sowing dates – one as soon as possible
after the main crop has been harvested, the other a week later; and four different sowing
densities – 1, 2, 4 or 8 kg ha-1. Treatment combinations were allocated to plots within blocks
at random.
Again, this is a density trial, and hence the variance may change over different planting
densities.
The plants are also grown for two different time periods. It is almost always the case that the
variance of plant yield increases over time. The following is an example of this.
72
Statistical Advisory & Training Service Pty Ltd
0.16
0.14
0.12
0.10
Dry weight
0.08
0.06
0.04
0.02
0.00
4-Aug-94 9-Aug-94 14-Aug-94 19-Aug-94 24-Aug-94 29-Aug-94 3-Sep-94 8-Sep-94 13-Sep-94
Date
A second example is calf weight for the first nineteen weeks after birth which we consider
again later:
380
360
340
320
300
Weight
280
260
240
220
200
0 2 4 6 8 10 12 14 16 18 20
Week
Again, the variance appears to increase as the calves grow. The means and variances over
time for these thirty calves are as follows.
73
Statistical Advisory & Training Service Pty Ltd
Week 0 2 4 6 8 10 12 14 16 18 19
Mean226.20230.33246.87265.63281.17294.87304.73 312.87 315.13 324.07 325.47
Variance105.54155.13165.22184.86242.97283.77306.55 340.67 389.15 470.06 444.60
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Block.*Units* stratum
Density 3 470.378 156.793 16.35 <.001
Sowing 1 233.708 233.708 24.37 <.001
Variety 1 83.951 83.951 8.75 0.005
Density.Sowing 3 154.793 51.598 5.38 0.003
Density.Variety 3 8.647 2.882 0.30 0.825
Sowing.Variety 1 36.451 36.451 3.80 0.057
Density.Sowing.Variety 3 17.999 6.000 0.63 0.602
Residual 45 431.611 9.591
Total 63 1601.275
Tables of means
Variate: Yield
Density 1 2 4 8
2.14 3.35 7.33 8.69
74
Statistical Advisory & Training Service Pty Ltd
For this experiment, the Fixed Model is Variety*Date*Density and the Random Model is
Block/Plot. As before, plots are completely described by the combination of
Variety*Date*Density, leading to Block+ Block.Variety*Date*Density as the Random Model. That
allows use to investigate Diagonal structures for Date and/or Density.
Change in:
Block Variety Sowing date Density deviance d.f. deviance d.f. P value
Identity Identity Diagonal Diagonal 162.05 42
Identity Identity Identity Diagonal 168.10 43 6.05 1 0.014
If we start assuming that the variance changes over time as well as over densities, we can then
test whether an adequate model has only a changing variance over densities (P = 0.014), or a
75
Statistical Advisory & Training Service Pty Ltd
changing variance over time (P = 0.003). We clearly should allow the variance to change
over both factors.
block Identity - - -
density Diagonal d_1 1.000 fixed
d_2 2.195 1.358
d_3 10.48 6.35
d_4 7.682 4.661
sowing Diagonal d_1 1.030 0.507
d_2 3.143 1.481
variety Identity - - -
To assist in understanding this output, we
Estimated covariance models turned on the option Covariance Model. GenStat
Variance of data estimated in form: has scaled σ2 to 1. The information on variance
estimates is then obtained in the diagonal
V(y) = sZZ' + Sigma2.R covariance matrices of the factors making up
the residual term. To take one block and one
where: V(y) is variance matrix of data
variety, the variance of Y is obtained by
s is the variance component for the random term
Z is the incidence matrix for the random term evaluating the direct product of the two
Sigma2 is the residual variance diagonal covariance matrices:
R is the residual covariance matrix
1.000 0 0 0
Random Term: block
Scalar s: 0.1604 0 2.195 0 0 1.030 0
⊗
0 0 10.48 0 0 3.143
Residual term: block.density.sowing.variety
Sigma2: 1.000 0 0 0 7.682
R uses direct product construction
76
Statistical Advisory & Training Service Pty Ltd
The matrix in the text book is a direct product of a 4×4 and a 2×2, giving an 8×8 matrix with
elements obtained by element-by-element multiplication of the separate matrices:
1.000×1.030 0 0 0 0 0 0 0
0 1.000×3.143 0 0 0 0 0 0
0 0 2.195×1.030 0 0 0 0 0
0 0 0 2.195×3.143 0 0 0 0
0 0 0 0 10.48×1.030 0 0 0
0 0 0 0 0 10.48×3.143 0 0
0 0 0 0 0 0 7.682×1.030 0
0 0 0 0 0 0 0 7.682×3.143
Density 1 2 4 8
Density Sowing date 21 28 21 28 21 28 21 28
21-Aug-90 1.030 0 0 0 0 0 0 0
1
28-Aug-90 0 3.143 0 0 0 0 0 0
21-Aug-90 0 0 2.261 0 0 0 0 0
2
28-Aug-90 0 0 0 6.899 0 0 0 0
21-Aug-90 0 0 0 0 10.794 0 0 0
4
28-Aug-90 0 0 0 0 0 32.939 0 0
21-Aug-90 0 0 0 0 0 0 7.912 0
8
28-Aug-90 0 0 0 0 0 0 0 24.145
Thus, the variance of an observation for any block and variety, whose density is 1 kg ha-1 and
sown on 21/08/1990 is estimated to be 0.1604 (= block variance) + 1.030 = 1.190. For a
similar combination but sown a week later, it is 0.1604 + 3.143 = 3.301.
Deviance: -2*Log-Likelihood
Deviance d.f.
162.05 42
Next we present just the two-way means for density and sowing for illustration. Since there
are changing variances over the levels of some factors, we should turn on the option Standard
77
Statistical Advisory & Training Service Pty Ltd
Errors All Differences so that individual differences can be compared or estimated with the
correct precision.
For example, to compare the two variety means at a density of 4 kg ha-1, we select treatments
numbered 5 and 6 from the Standard errors of differences between pairs table for the in the
output. We then read the value where the row marked
intersects with the column marked 5. The mean difference is 10.737-3.912 = 6.825 ± 2.338.
Note from the Wald statistic that the df are 18.8, so for assessing the significance of this
difference we would use 18.8 or 19 df. The t value is 6.825/2.338 = 2.92, and this is highly
significant (P=0.009). The 95% confidence interval for the true varietal difference at 4 kg ha-1
is (1.93, 11.72) kg ha-1.
The ANOVA 14
had a P value 28/08/1990
12
for
Sowing.Variety 10
of 0.057 and a
Mean yield
constant s.e.d. 8
of 1.548 for 6
comparing
two means 4
21/08/1990
and. Using 2
this average-
type value 0
leads to 0 1 2 3 4 5 6 7 8 9
difficulty in
Density (kg ha-1)
comparing
means with
appropriate
precision.
Table of predicted means for density.sowing
sowing 21/8/90 28/8/90
density
1kg/Ha 1.763 2.512
2kg/Ha 3.013 3.688
4kg/Ha 3.912 10.737 To compare these means, use
8kg/Ha 5.175 12.212
78
Statistical Advisory & Training Service Pty Ltd
Occasionally we need to block in two directions in the field (especially in animal trials, where
individual animals form one block, and the experiment is repeated over time, time forming a
second block).
For a Latin Square design, we need to have as many blocks in both directions as we have
treatments. We then balance the allocation of treatments so that each occurs just once in each
row and once in each column.
We have marked a typical row block, a typical column block, and a typical plot (the
intersection of a row block and a column block). Thus, there are three strata, and hence the
Block Structure is
which can be shortened to Row*Column, or, since the final stratum can always be omitted,
Row + Column.
79
Statistical Advisory & Training Service Pty Ltd
Example 12 Wheat yields (kg per plot) from Steel and Torrie, page 224.
Analysis of variance
Variate: Yield
Row_Block.Column_Block stratum
Variety 3 78.9250 26.3083 58.03 <.001
Residual 6 2.7200 0.4533
Total 15 90.4000
Tables of means
Variate: Yield
Variety A B C D
12.00 12.27 10.80 6.72
80
Statistical Advisory & Training Service Pty Ltd
From the stratum variances, columns show more variability than rows.
For this design there are three variance estimates coming from the three strata – rows,
columns and plots. As before, the Fixed Model contains the one factor, Variety, while the
Random Model is Row_Block + Column_Block + Row_Block.Column_Block, or simply
Row_Block*Column_Block.
81
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
13.97 9
Notice, as usual:
Variety
Variety A 1 *
Variety B 2 1.165 *
The estimates of variance are the same as the stratum variances given in the ANOVA.
The means and s.e.d. values are the same as from ANOVA. REML also gives 1.165 as
the common least significant difference (5% level) of means (in a complete matrix of
values).
82
Statistical Advisory & Training Service Pty Ltd
Firstly, we will use GenStat’s Design menu to generate a field plan to correspond to Steel and
Torrie’s oats experiment (page 383) with four varieties randomised to whole plots and four
chemical seed treatments (one of which is a control) to split plots. Appropriate factor labels
have replaced numbers.
Notice that GenStat creates three factor columns (Block, W_Plot and S_Plot), one for each of
the three strata in this experiment. The field plan is also printed in the Output window.
S_Plots 1 2 3 4
Block W_Plots
1 1 4 3 4 4 4 1 4 2
2 3 4 3 1 3 2 3 3
3 1 3 1 2 1 4 1 1
4 2 2 2 4 2 3 2 1
2 1 1 1 1 4 1 3 1 2
2 2 4 2 1 2 3 2 2
3 3 1 3 4 3 2 3 3
4 4 2 4 4 4 1 4 3
3 1 4 4 4 1 4 2 4 3
2 1 3 1 1 1 2 1 4
3 3 2 3 3 3 1 3 4
4 2 2 2 4 2 3 2 1
4 1 1 2 1 3 1 1 1 4
2 3 3 3 4 3 1 3 2
3 2 4 2 1 2 3 2 2
4 4 4 4 3 4 1 4 2
83
Statistical Advisory & Training Service Pty Ltd
There are clearly three strata here: blocks, the ¼ block strips (the whole-plots) that the
varieties are randomised to, and the ¼ whole-plot shapes (the split-plots) that the seed
protectants were assigned to at random. The Block Structure is therefore
Block/Whole_Plot/Split_plot
which describes the way the units were formed in the field: whole-plots were formed as large
units within blocks, and split-plots were formed as smaller units within whole-plots.
Providing you set up these three factors, this structure is what you would use irrespective of
the complexity of the whole-plot treatment and the split-plot treatment structures. For
example, the treatments applied to whole-plots could have a 3×4 factorial structure, while
those applied to the split-plots a (2×2+1) incomplete factorial structure.
For this example, there were simple structures for both whole-plot and split-plot treatment
structures. Hence the following Block Structure can be used instead:
84
Statistical Advisory & Training Service Pty Ltd
This, in fact, forms the whole-plot part of the combined split-plot ANOVA.
2. Four separate RCBDs, one per variety, with seed chemical protectants as treatments.
This is one such layout, for Branch.
In fact, this is an important concept in checking the assumptions at the split-plot level. This
ANOVA produces 9 df for the Residual MS. There are four such residuals to check for
“homogeneity”; their average is, in fact, the split-plot Residual MS in the combined analysis.
The combined analysis is feasible only when these individual variance components are
commensurable.
85
Statistical Advisory & Training Service Pty Ltd
First, the standard split-plot ANOVA is obtained (using the specific split-plot menu).
Analysis of variance
Variate: Yield
Block.Cultivar stratum
Cultivar 3 2848.02 949.34 13.82 0.001
Residual 9 618.29 68.70 3.38
Block.Cultivar.Chemical stratum
Chemical 3 170.54 56.85 2.80 0.054
Cultivar.Chemical 9 586.47 65.16 3.21 0.006
Residual 36 731.20 20.31
Total 63 7797.39
86
Statistical Advisory & Training Service Pty Ltd
Tables of means
Variate: Yield
GenStat organizes the analysis into three strata corresponding to what was done in the field.
Notice the following.
is tested in the whole-plot stratum, since whole-plots are the replicates for this
Cultivar
treatment factor.
Chemical and Cultivar.Chemical are tested in the split-plot stratum, since split-plots are the
replicates for this treatment/interaction.
There are several s.e.d. and l.s.d. values. Each is used for an appropriate treatment mean
comparison. Not all comparisons lead to exact t tests. Performing a two stage
randomization in the field has made the subsequent analysis slightly more complex than a
one stage randomization.
87
Statistical Advisory & Training Service Pty Ltd
Before interpreting the analysis, we should check the residual plot. Maybe there is some
fanning, but nothing jumps out as a major problem.
Yield
Histogram of residuals Fitted-value plot
3
20.0
17.5 2
15.0
1
Residuals
12.5
0
10.0
7.5 -1
5.0
-2
2.5
0.0
-3 -2 -1 0 1 2 3 30 40 50 60 70
Fitted values
2 2.5
1 2.0
Residuals
0 1.5
-1 1.0
-2 0.5
0.0
-2 -1 0 1 2 0.0 0.5 1.0 1.5 2.0 2.5
Expected Normal quantiles Expected Normal quantiles
Before interpreting the analysis, the components that form the split-plot error should be
checked.
We do this in GenStat by clicking in the spreadsheet, then Restrict/Filter > To Groups (factor
levels). Select Cultivar and, one by one, each of the levels to perform a simple RCBD
ANOVA. The Residual MS values (each with 9 df) are 4.128(Vicland (1)), 34.40 (Vicland (2)),
29.76 (Clinton), 12.96 (Branch). These appear quite different. Their average is 20.312, which
is the split-plot Residual MS, with 4×9 = 36 df. In fact, performing a Bartlett test of
homogeneity of variances on these indicates significance at P=0.021.
88
Statistical Advisory & Training Service Pty Ltd
Steel and Torrie give further information about these varieties. Vicland (1) is a variety
infected with H. victoriae, Vicland (2) is the same variety but is not infected. Clinton and
Branch are varieties resistant to H. victoriae. The variation in the Vicland (1) data appears
smaller than for the other varieties. It is possible that the actual levels of this factor are
associated with different variances: one level is expected to have consistently smaller yields,
since these seeds have been infected. Linear Mixed Models (REML) allows us to model this.
Has the combined analysis overlooked this problem? If we Save the fitted values and
residuals, we can obtain a residual plot with different colours for the different varieties.
15
10
5 branch
Resiudal
clinton
vicland1
0 vicland2
-5
-10
25 30 35 40 45 50 55 60 65 70 75
Fitted value
In this plot, the residuals from Vicland (1) appear less varied than the other varieties
(corresponding to the significantly smaller variance in the yields of this variety). It would
appear that the combined split-plot analysis is inappropriate for these data.
89
Statistical Advisory & Training Service Pty Ltd
For this split-plot there are three strata: blocks, whole-plots and split-plots. Hence, the
Random Model is Block/W_Plot/S_Plot. In order to allow a changing variance across cultivars,
we need to mention them in the Random Model. Cultivars were allocated at random to the
whole plots, so we can express the Random Model as Block/Cultivar/S_Plot,
Block/Cultivar/Chemical, or simply as Block/Cultivar since the final stratum can be omitted. The
stratum variances were estimated in ANOVA as follows:
Deviance: -2*Log-Likelihood
Deviance d.f.
237.21 45
90
Statistical Advisory & Training Service Pty Ltd
Standard errors
LMM (REML) gives the same means, s.e.m., s.e.d. and l.s.d. values as ANOVA, but in full
matrix form.
Next, we demonstrate how to check for changing variance across cultivars. Given the nature
of the cultivars and seed chemical protectants, we might expect this variance to change only
at the split-plot level. The following change in deviance table explores various models for
Cultivar in firstly the split-plot error term (Block.Cultivar.Chemical) and then in the whole-plot
error term (Block.Cultivar).
The analysis allowing for a changing variance at the split-plot level is as follows. Use Save if
you want to take the s.e.d. values into Excel or Word most efficiently.
91
Statistical Advisory & Training Service Pty Ltd
Block Identity - - -
Cultivar Diagonal d_1 12.81 5.98
d_2 33.19 16.03
d_3 4.060 1.898
d_4 37.03 17.41
Chemical Identity - - -
92
Statistical Advisory & Training Service Pty Ltd
Cultivar Branch 1 *
Cultivar Clinton 2 2.60 *
Cultivar Vicland (1) 3 2.22 2.49 *
Cultivar Vicland (2) 4 2.64 2.87 2.54 *
1 2 3 4
`
Table of predicted means for Chemical
Chemical Control Ceresan Panogen Agrox
50.69 55.20 53.12 52.22
Standard errors
Notice that the s.e.m. values are all higher than those obtained from the split-plot ANOVA,
which were given as 2.846 (the first of the two possibilities). For the ANOVA, the block
effect sums to 0 for each mean so the block effect is not part of the calculation.
93
Statistical Advisory & Training Service Pty Ltd
Since the variance appears to change across a single factor (Cultivar), the analysis is simply
performed using Stats > Meta Analysis > REML of Multiple Experiments. The fixed and random
models are those from ANOVA or LMM; we simply declare Cultivar as the “notional” factor
over which the residual changes across “Experiments”:
94
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
225.78 42
Notice that the parameterization for the variances is slightly different here. A random error
term is added with a variance σ2 whose estimate (1.00) is shown as “aliased”:
Random term component s.e.
Block.Cultivar.Chemical 1.00 aliased
This value needs to be added to the separate estimates of variances for the four cultivars (e.g.
for Branch, the estimate of variance is 11.81+1.00 = 12.81, which was the the Residual MS
from the RCB analysis of the Branch data in the four blocks with the four chemical
treatments).
With the more realistic modeling of changing variances across cultivars in the split-plot
experiment, sem and sed values all change. Selecting to show Standard Errors of All Estimates
in the options shows the effect of this change. With a constant variance model, the sem value
is 4.67. With a changing variance model, it varies from a low 4.11 to a high 5.01. Unlike the
ANOVA, the calculation of the s.e.m. value involves the block variance, the whole-plot
variance and the split-plot variance.
Standard errors
95
Statistical Advisory & Training Service Pty Ltd
GenStat creates, as before, a Block stratum, a W_Plot stratum and a S_Plot stratum. This time,
there are three factors required to fully define the whole-plots. Nevertheless, the Block
Structure remains as Block/W_Plot/S_Plot.
96
Statistical Advisory & Training Service Pty Ltd
Curt Lee (Agro-Tech, Inc., Velva, North Dakota, USA) kindly supplied data from the
following experiment on wheat.
Six blocks were set up and each divided into two whole-plots (WP). One whole-plot was
randomly fertilized with a full recommended rate of nitrogen fertilizer (Standard), the other
not fertilized (Reduced). The final applied-N plus residual-N was 100 lbs for the standard
fertility and 50 lbs for the reduced fertility plots.
Each whole-plot was divided into four split-plots (SP). The four treatments allocated
randomly to these plots were a fungicide treatment (or a blank treatment), and an early (at the
tillering stage) or a late (at the flag leaf stage) application of the fungicide and the blank.
Block WP 1 2 3 4 1 2 3 4 WP Block
The blank plots were sprayed with the treatments that contained all the carrier material
(water, solvents, etc), except the active ingredient. Thus, since a treatment was actually
applied to the blank plots, the split-plot treatments can be thought of as a 2 × 2 factorial
combination.
Alternatively, you can think of the split-plot treatments as a simple set of four treatments, and
extract three contrasts to estimate the following characteristics.
97
Statistical Advisory & Training Service Pty Ltd
a) Estimate the effect of the fungicide versus no fungicide, by comparing the mean
yields from fungicide (early and late) plots to no fungicide (early and late) plots.
b) Estimate the effect of different timing by comparing the mean yields from
fungicide early plots to fungicide late plots.
c) Estimate the effect of the two check treatments by comparing the mean yields
from no fungicide early plots to no fungicide late plots. (They should yield the
same, unless they are getting something out of the carrier materials.)
Block.W_Plot stratum
Fert 1 4.7376 4.7376 45.38 0.001
Residual 5 0.5220 0.1044 0.97
Block.W_Plot.S_Plot stratum
Fung 1 2.7552 2.7552 25.51 <.001
Timing 1 0.5043 0.5043 4.67 0.039
Fert.Fung 1 0.2002 0.2002 1.85 0.183
Fert.Timing 1 0.0261 0.0261 0.24 0.626
Fung.Timing 1 0.6674 0.6674 6.18 0.019
Fert.Fung.Timing 1 0.0000 0.0000 0.00 0.993
Residual 30 3.2398 0.1080
Total 47 14.8322
Tables of means
etc…
The three residuals were all from edge plots in blocks 4, 5 and 6. On checking, the research
company discovered that these plots had not been trimmed to equal length. For their analysis
they went back, measured each plot and corrected the yield based on actual harvested plot
length. We will not do that here.
98
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Yield
Block.W_Plot stratum
Fert 1 4.7376 4.7376 45.38 0.001
Residual 5 0.5220 0.1044 0.97
Block.W_Plot.S_Plot stratum
Split_treatment 3 3.9269 1.3090 12.12 <.001
Fung vs none 1 2.7552 2.7552 25.51 <.001
Fung Early vs Late 1 1.1660 1.1660 10.80 0.003
Blank Early vs Late 1 0.0057 0.0057 0.05 0.820
Fert.Split_treatment 3 0.2263 0.0754 0.70 0.560
Fert.Fung vs none 1 0.2002 0.2002 1.85 0.183
Fert.Fung Early vs Late 1 0.0126 0.0126 0.12 0.735
Fert.Blank Early vs Late 1 0.0135 0.0135 0.13 0.726
Residual 30 3.2398 0.1080
Total 47 14.8322
99
Statistical Advisory & Training Service Pty Ltd
Tables of means
Grand mean 2.670
100
Statistical Advisory & Training Service Pty Ltd
3 1 2 13000
1 2 3 16000
1 3 2 10000
Block 3
2 3 1 16000
3 2 1 10000
3 1 2 13000
1 2 3 16000
1 3 2 10000
3 2 1 13000
Block 4
1 3 2 10000
1 3 2 16000
1 2 3 13000
2 1 3 10000
3 1 2 16000
3 2 1 13000
101
Statistical Advisory & Training Service Pty Ltd
An experiment was conducted to determine that effects of irrigation, planting density (or
stand), and fertilizer level on the yield of corn. The smallest area that could be irrigated was
half a block – or one whole-plot. The two irrigation treatments were randomly allocated to
the whole-plots in each of four blocks. Each whole-plot was divided into three split-plots, and
with three planting densities (rates of 10,000, 13,000 and 16,000 plants acre-1) randomly
allocated to each. Finally, each split-plot was divided into three split-split-plots, with three
fertilisers (60, 120 and 180 lb of nitrogen) randomly allocated to each.
This is quite a different layout compared to a simple RCBD in which all 18 treatment
combinations could occur in any plot of each block. In this case, practical limitations dictated
the layout; the penalty is a more complex analysis. The Block Structure comes about as
follows.
Blocks were identified in the field, so Block forms the first stratum.
Half block areas were prepared and one of these in each block was (randomly) irrigated,
forming a Block.Irrigated stratum. Irrigated and non-irrigated plot means are compared
within this stratum, which is basically an RCBD with 4 blocks and 2 treatments.
Each half-block was split into three areas and one of three spacings used (randomly) in
each. Thus, we have a third stratum, Block.Irrigated.Spacing, and these units are used in
constructing Spacing and Spacing.Irrigated F-tests.
Each spacing strip was split into three even smaller areas and one of three fertilisers
applied (randomly) in each. This gives rise to a fourth and final stratum,
Block.Irrigated.Spacing.Fertiliser, and these units are used in constructing F-tests for the
Fertiliser main effect and any interaction involving this factor.
Example 15 Yields of corn (bushels acre-1) from Snedecor & Cochran page 328
102
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Block.Irrigated stratum
Irrigated 1 8277.56 8277.56 17.59 0.025
Residual 3 1411.78 470.59 2.03
Block.Irrigated.Stand stratum
Stand 2 1758.36 879.18 3.78 0.053
Irrigated.Stand 2 2747.03 1373.51 5.91 0.016
Residual 12 2787.94 232.33 2.69
Block.Irrigated.Stand.Fertilizer stratum
Fertilizer 2 1977.44 988.72 11.45 <.001
Irrigated.Fertilizer 2 953.44 476.72 5.52 0.008
Stand.Fertilizer 4 304.89 76.22 0.88 0.484
Irrigated.Stand.Fertilizer
4 234.72 58.68 0.68 0.611
Residual 36 3108.83 86.36
Total 71 23756.44
Block 2 Irrigated Irrigated Stand 10,000 Fertilizer 60. 14.7 s.e. 6.6
Block 3 Irrigated Irrigated Stand 10,000 Fertilizer 60. -14.6 s.e. 6.6
Tables of means
Grand mean 99.7
103
Statistical Advisory & Training Service Pty Ltd
104
Statistical Advisory & Training Service Pty Ltd
Comparing 2-way and 3-way means is now a complex procedure. Note, however, that
comparing two densities (/two fertilizers) both of which were irrigated (or non-irrigated) is
straightforward (the l.s.d. values are 13.56/7.69), and so on. The differences in means come
down to two significant interactions, and the following plots make these differences clear:
130 130
120 120
non-irrigated
Mean yield
Mean yield
110 110
non-irrigated
100 100
irrigated
90 90
irrigated
80 80
7,000 10,000 13,000 16,000 19,000 0 60 120 180
Planting density (plants acre-1) Nitrogen (lb)
Note that the Block MS is smaller than the highest stratum Residual MS, which is unusual.
When analysing via REML we would be advised to force variance components to be positive.
In the analysis above, we also ignored the potential variance problem we discussed
previously brought about by having varying planting densities.
This experiment illustrates the occasional need to restrict the variance estimates to be
positive. In the ANOVA, the variance of the block stratum was estimated as -22.54 simply
because the Block MS was smaller than the Residual MS in the whole-plot analysis. This
indicates the absence of any block effect.
For a split-split-plot design there are four strata, the Fixed Model being the same as the
Treatment Structure of ANOVA (Fertilizer*Irrigated*Stand) and the Random Model being the
same as the Block Structure (Block/Irrigated/Stand/Fertilizer). To ensure that all stratum
variances are positive, you need to click Initial Values, choose Block and select positive for
Constraints.
105
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
338.38 50
106
Statistical Advisory & Training Service Pty Ltd
Criss-cross/split-block/strip-plot design
This design has various names in the literature, but the essential difference is that a second
(possibly factorially structured) treatment is randomly applied across large areas of each
block, generally at right angles to the first treatment. For example, this is one block from a
factorial trial in which hybrids are allocated to four plots in the block, and a herbicide
treatment (absent, or one of two rates) is applied to one-three block areas stripped across the
plots.
A corresponding split-plot design has the herbicide treatment applied at random to the three
small plots within each whole-plot. This more complex arrangement is often the only
practical way of running the experiment, but comes at the cost of greater complexity in
treatment comparisons.
The levels of the herbicide treatment are also applied to large areas in each block. Thus, there
are two types of whole-plots. There are now four strata: Block, Block.Hybrid, Block.Herbicide,
and Block.Hybrid.Herbicide (an individual plots whose yields are measured).
Example 16 Curt Lee (Agro-Tech, Inc., Velva, North Dakota, USA) kindly supplied data
from the following experiment on sunflower (yield in lb/acre). Hybrid number
shown in each block (V1 to V7).
Block Herbicide V1 V2 V3 V4 V5 V6 V7
1 check 810.6 1369.7 1830.8 1335.8 1563.6 1419.5 726.8
rate 1 776.8 1115.4 1497.0 1610.8 1637.0 1236.2 679.4
rate 2 595.2 1175.9 1260.0 1204.3 1465.2 1172.2 669.8
V6 V5 V4 V7 V2 V1 V3
2 rate 1 1429.4 1152.8 1150.4 744.1 1099.0 735.2 1413.9
check 1517.5 1971.4 1737.6 643.4 916.2 608.3 1747.6
rate 2 1696.2 1467.0 1456.1 662.8 906.7 562.5 1417.2
V4 V2 V6 V7 V3 V1 V5
3 rate 2 1383.6 1328.2 1301.4 671.6 1805.0 709.7 1536.6
check 1638.7 1250.8 1411.5 762.6 1827.9 601.4 1685.0
rate 1 1727.8 1201.4 1576.8 748.2 1340.2 670.8 2193.3
V4 V1 V7 V2 V5 V6 V3
4 rate 1 1414.4 562.3 833.6 1085.4 1480.6 1323.9 1683.9
rate 2 1329.2 845.3 884.5 1069.9 1822.1 1277.1 1734.2
check 1318.4 760.4 842.6 1147.4 1729.5 1212.6 1450.5
107
Statistical Advisory & Training Service Pty Ltd
It is common practice to place treatments for dose response experiments in sequential order
(not randomized) in the first block of a field trial. This is used to accommodate farmer tours
so they may walk through the trial and see the expected differences. There is a debate as to
whether the demonstration block should be used as part of the research data, but we will do
so here.
The Block Structure is slightly more complex to formulate with a shortcut. The four strata
mentioned above technically is all that is needed to set up the block structure, so:
Analysis of variance
Variate: Yield
Block.Hybrid stratum
Hybrid 6 10890886. 1815148. 65.92 <.001
Residual 18 495649. 27536. 0.83
Block.Herbicide stratum
Herbicide 2 111333. 55666. 1.22 0.360
Residual 6 274730. 45788. 1.38
Block.Hybrid.Herbicide stratum
Hybrid.Herbicide 12 130254. 10855. 0.33 0.979
Residual 36 1192168. 33116.
Total 83 13260309.
Tables of means
Grand mean 1231.
Hybrid V1 V2 V3 V4 V5 V6 V7
687. 1139. 1584. 1442. 1642. 1381. 739.
Herbicide Check H1 H2
1280. 1219. 1193.
108
Statistical Advisory & Training Service Pty Ltd
There are strongly significant differences (P < 0.001) among hybrids, but no interaction or
herbicide effect. The interpretation is therefore straightforward. In the presence of a
significant interaction, individual means will have to be compared using one of three l.s.d.
values, none of which leads to a strict t test (notice the non-integer degrees of freedom).
Notice also the negative Block.Hybrid stratum variance. When using LMM (REML) we would
set that to be non-negative. The analysis is straightforward using the fixed and random
models described above.
109
Statistical Advisory & Training Service Pty Ltd
This experiment was used by Schabenberger and Pierce (2001), page 599, to illustrate a
REML analysis in SAS. Four soybean cultivars were used as whole-plots in each of four
replicate blocks. Two row spacings (9”, 18”) were used, each applied at random to half of
each whole-plot in a vertical direction. In addition, five target plant populations (60, 120, …,
300 thousand per acre) were used, each applied at random to one-fifth of each whole-plot in a
horizontal direction. The field plan therefore appears as follows.
Example 17 Soybean example, from Schabenberger and Pierce (2001), page 599
There are five strata in this experiment, and the block structure is the sum of these terms:
1. Block stratum
2. Block.Cultivar stratum
3. Block.Cultivar.Row stratum
4. Block.Cultivar.Plant stratum
5. Block.Cultivar.Row.Plant stratum
110
Statistical Advisory & Training Service Pty Ltd
Column
Row 1 2 3 4 5 6 7 8
1 19.5 26.2 26.4 32.5 23.4 21.3 29.4 32.0
2 23.9 23.3 25.7 24.2 24.0 25.9 25.2 26.1
3 22.0 21.9 19.0 16.3 27.6 28.1 31.5 29.1
4 19.4 20.0 22.9 21.7 21.8 21.9 26.6 25.0
5 19.0 15.8 26.0 27.9 25.9 22.0
6 23.4 22.4 26.0 32.9 21.9 23.9
7 20.6 19.7 26.9 25.9 27.9 31.4 26.5
8 28.2 27.9 25.6 24.8 32.1 34.2 24.5 21.4
9 25.9 28.5 23.0 23.3 26.5 40.2 28.9 30.5
10 22.0 30.3 28.8 30.4 25.1 35.9 28.0 23.3
11 17.8 22.3 16.5 19.3 22.0 28.9 23.6 21.6
12 20.9 23.3 23.3 26.6 27.9 36.9 17.2 20.8
13 26.5 26.2 28.0 30.4 27.0 32.1 24.9 24.6
14 25.9 24.2 24.2 30.1 23.2 26.9 33.0 35.3
15 22.8 19.0 22.0 26.9 26.9 34.5 30.7 25.3
16 16.2 13.0 20.4 23.6 21.4 17.6 25.2 21.1
17 26.5 25.4 21.0 24.4 23.3 26.9 26.7 26.1
18 27.5 21.9 23.2 26.2 16.0 23.2 25.5 23.5
19 17.9 24.4 21.7 21.3 27.1 14.7 15.6
20 19.8 22.2 15.6 17.7 26.2 32.4 26.0 26.4
There are six missing yields. GenStat will analyse the data via General Analysis of Variance.
However, missing values are inserted and therefore F tests are inflated upwards. In addition,
there may well be a change in variance across both row spacings and plant populations, and
there may well be a better spatially correlated model to use, so it is preferable to use LMM
(REML).
Block Structure:
Block+Block.Cultivar+Block.Cultivar.Row+Block.Cultivar.Plant+Block.Cultivar.Row.Plant
Analysis of variance
Variate: Yield
111
Statistical Advisory & Training Service Pty Ltd
Block.Cultivar stratum
Cultivar 3 531.821 177.274 9.18 0.004
Residual 9 173.723 19.303
Block.Cultivar.PlantPop stratum
PlantPop 4 1173.923 293.481 33.72 <.001
Cultivar.PlantPop 12 139.997 11.666 1.34 0.230
Residual 46 (2) 400.406 8.704 2.20
Block.Cultivar.RowsSpacing stratum
RowsSpacing 1 38.125 38.125 3.47 0.087
Cultivar.RowsSpacing 3 185.301 61.767 5.63 0.012
Residual 12 131.682 10.974 2.77
Block.Cultivar.PlantPop.RowsSpacing stratum
PlantPop.RowsSpacing 4 18.891 4.723 1.19 0.327
Cultivar.PlantPop.RowsSpacing 12 122.997 10.250 2.59 0.011
Residual 44 (4) 174.146 3.958
112
Statistical Advisory & Training Service Pty Ltd
There are four blocks, three fixed factors (4 cultivars × 2 row spacings × 4 target plant
populations) in a five stratum layout. To obtain a better analysis than ANOVA, we use LMM
(REML) with the following models:
Deviance: -2*Log-Likelihood
Deviance d.f.
395.74 109
113
Statistical Advisory & Training Service Pty Ltd
The similarities are clear, with the differences between the two analyses (apart from P values)
due to the fact that REML uses just the data and ignores missing values.
However, we should investigate whether the variance changes with changing row spacing
and changing plant population. Unfortunately, GenStat’s analysis failed to converge when we
tried this. To make headway, we tried the following.
The Block.Cultivar variance component is very small (0.452) and in fact can be deleted (the
change in deviance is 395.96 - 395.74 = 0.22 with 1 d.f.). This is a simpler analysis which,
apart from round-off error due to iteration with many parameters, produces the same variance
components and close P values, with the exception that the individual Block and Block.Cultivar
variance components of the first analysis (3.037 and 0.452) are replaced by a combined
variance component of 3.465. This analysis is equivalent to treating the b × c plots (b blocks
× c cultivars) as strips in the field into which the other factors are randomised (in two
different ways). The analysis with changing variances for these factors did converge.
It turns out that that this more complex model is unnecessary, with a change in deviance of
401.01 – 397.48 = 3.53 with 5 d.f. (3.53 would be not significant if there was just 1 d.f.).
Statistically, the first LMM (REML) analysis is the one to use for decisions; biologically, the
plants within plots are competing to the point that a common variance model appears
adequate.
The only point to add is that the design is unbalanced (with 6 missing values) and hence the P
values depend on the order the factors are added to the model. As usual with unbalanced data,
the P value to use for a factor should be the one obtained from an analysis with that factor
entered last.
114
Statistical Advisory & Training Service Pty Ltd
Spatial model: two-way design (in randomized blocks) plus a control plus extra
replication of the control plus a covariate
An experiment was laid out in four randomized blocks, designed to determine the
effectiveness of four soil fumigants in keeping down the numbers of eelworms in the soil.
The fumigants were chlorodinitrobenzene (CN), carbon disulphide jelly (CS) and two
proprietary preparations, “Cymag” (CM) and “Seekay” (CK). Each fumigant was tested both
in a single and double dose. There was a 9th treatment, viz a control (no fumigant): four plots
in each block were left untreated. The purpose was to supply an accurate standard against
which the performance of the fumigants was measured. The fumigants were ploughed in
during spring, after which a crop of oats was sown. Before and after harvest, 400g of soil was
taken from each plot and the number of eelworm cysts counted.
Although there is a 4 × 2 factorial structure (Fumigant × Dose), once the control treatment is
added the treatment structure is a bit more complex. Since the control is “no fumigant”, there
is no way of having a single and double dose of “nothing”. So initially, we need to think of
this as a one-way treatment design with (4×2+1) levels. We have 9 treatments, 8 of which are
factorially structured. So in the Design menu we select One-way (in Randomized Blocks), set
the number of treatments to 9, then go into Options. We set up a 1 df contrast for the treated
versus untreated plots, and set up the 4 × 2 factorial structure in that menu. In addition, we
can get GenStat to replicate the Control treatment 4 times (an additional 3 replicates per
block):
115
Statistical Advisory & Training Service Pty Ltd
Notice that GenStat creates a factor (with 1s and 2s) to compare treated and untreated plots: a
1 represents an untreated plot (throughout the spreadsheet) and 2 a treated plot. Then, in the
Output window, the Treatment Structure is shown as Control_Treated/(Fumigant*Dose).
Remember that the / operator has a higher priority than the * operator, so the parentheses are
important in this structure, to force the / operator on all three terms in the factorial structure.
This might be clearer with the following explanation.
If you examine the other factor levels in the spreadsheet you will see that the combination of
fumigant number (2, 3, 4, 5) and dose number (2 = single, say, and 3 = double) occurs only
when the Control_Treated level is 2 (ie treated). Fumigant and dose treatments are “nested”
inside the treated versus control contrast. The effect is that, in the ANOVA, apparent first-
order interactions (like Control_Treated.Fumigant) are actually main effects and the apparent
second-order interaction (Control_Treated.Fumigant.Dose) is first-order interaction
Analysis of variance
Source of variation d.f. think of this component as:
Blocks.Plots stratum
Control_Treated 1 Control_Treated contrast
Control_Treated.Fumigant 3 Fumigant main effect (for treated plots)
Control_Treated.Dose 1 Dose main effect (for treated plots)
Control_Treated.Fumigant.Dose 3 Fumigant.Dose interaction (for treated plots)
Residual 36
Example 18 Dose (1 = single, 2 = double) and type of fumigant, and eelworm counts
(initial above final) in field position, from Cochran and Cox page 46
116
Statistical Advisory & Training Service Pty Ltd
Had we used GenStat to design the trial, we need only add the two data columns (final and
initial counts) and Run the analysis via the Spread menu.
The analysis is performed in GenStat by initially setting up two factor columns: a Block factor
with 4 levels and a soil Treatment factor with 9 levels. Then in Options, we set up a factor to
identify treated and untreated plots, and two treatment factor columns, Dose (Single, Double)
and Fumigant (CK=Seekay, CM=Cymag, CN=chlorodinitrobenzene, CS= carbon disulphide
jelly). We have the added complication that the control is replicated 4 times in each block.
There are some issues to sort out with data like these.
The data are not normally distributed. It is possible that they are Poisson, in which case
the variance is the same as the mean, and if the means change then so must the variances.
Hence a logistic regression might be preferable to ANOVA. Alternatively, we could
transform the data to achieve approximate constant variance. For Poisson data the square
root transformation used to be recommended. With large counts, a log transformation
may be better: differences in means are then more easily back-transformed and
interpreted.
The final counts may well depend on the initial worm counts: if the worms are not
uniformly spread at the start of the experiment, then differences at the end may be
misleading. We should incorporate initial counts as a covariate. If we log-transform final
counts, then we should log-transform initial counts as well.
The Poisson distribution tends to a normal distribution with increasing mean count. Thus,
we could use LMM (REML) assuming an approximate normal distribution with a
changing variance, and possibly a spatially correlated error structure. Notice that the four
blocks are formed as a 2 × 2 layout in the field, and in each block the plots are arranged in
a 3×4 grid. If there is a gradient left to right and top to bottom across blocks, we might
expect a gradient left to right and/or top to bottom within the blocks. What has become
117
Statistical Advisory & Training Service Pty Ltd
known as a Row-Column analysis might then remove a trend in the field more
successfully than the 2 × 2 block layout.
We will look at some of these actions. Firstly, an analysis of final counts with initial counts
as a covariate shows a distinct fanning in the standardised residuals:
Final_Count
Histogram of residuals Fitted-value plot
14
3
12
2
10 Residuals
8 1
6 0
4
-1
2
-2
0
-2 -1 0 1 2 3 0 100 200 300 400 500
Fitted values
3
3.0
2
2.5
Residuals
1 2.0
0 1.5
1.0
-1
0.5
-2
0.0
-2 -1 0 1 2 0.0 0.5 1.0 1.5 2.0 2.5
Expected Normal quantiles Expected Normal quantiles
log_Final_Count
Histogram of residuals Fitted-value plot
2
12
10 1
Residuals
8
0
6
-1
4
2 -2
0
-3 -2 -1 0 1 2 3 4.0 4.5 5.0 5.5 6.0 6.5
Fitted values
2.5
1 2.0
Residuals
0 1.5
-1 1.0
-2 0.5
0.0
-2 -1 0 1 2 0.0 0.5 1.0 1.5 2.0 2.5
Expected Normal quantiles Expected Normal quantiles
118
Statistical Advisory & Training Service Pty Ltd
Block stratum
Covariate 1 4.76145 4.76145 11.74 0.076
Residual 2 0.81127 0.40563 4.23 4.58
Block.*Units* stratum
Treated_Control 1 1.16420 1.16420 12.13 1.00 0.001
Treated_Control.Fumigant 3 2.08349 0.69450 7.24 0.92 <.001
Treated_Control.Dose 1 0.04506 0.04506 0.47 0.99 0.498
Treated_Control.Fumigant.Dose 3 0.31977 0.10659 1.11 1.00 0.358
Covariate 1 5.21084 5.21084 54.31 <.001
Residual 35 3.35793 0.09594 2.48
Total 47 16.92526
119
Statistical Advisory & Training Service Pty Ltd
Clearly initial counts go a long way to explaining differences in final counts. Incorporating
the initial counts as a covariate:
reduces the Residual MS from 0.2380 to less than half that value, 0.0959;
more accurately tests whether treated plots have significantly lower eelworm cysts than
control plots, taking initial counts into account (P=0.001);
120
Statistical Advisory & Training Service Pty Ltd
The back-transformed mean of log-transformed data is the geometric mean of the original
data. For log-normal data, the geometric mean is a much better estimate of a “typical”
value than the arithmetic mean, since the importance of very large values in the
calculation is greatly reduced.
The back-transformed difference in two means of log-transformed data is the ratio of the
two geometric means of the original data. For example, for the carbon disulphide jelly
(CS) fumigant, the effect of a single compared to a double dose is 5.399 – 5.041 = 0.358
on the log-scale. This back-transforms to 1.43. Thus, a plot with a single dose of carbon
disulphide jelly applied typically has 43% more eelworms cysts than a similar plot with a
double dose.
The l.s.d. value for the comparison above is 0.4520 and this is based on 35 df for which
tcrit is 2.030. The value to add and subtract to the difference in means above is
2.030×0.4520 = 0.918. The 95% confidence interval on the log-scale is (-0.560, 1.276).
Back-transforming the end points gives a confidence interval for the ratio of (0.571,
3.581). Thus, while a plot with a single dose of carbon disulphide jelly applied typically
has 43% more eelworms cysts than a similar plot with a double dose, we are only 95%
confident that this ratio is between just over a half (0.571×), to a little more than three and
a half times (3.581×). Other differences are treated similarly.
121
Statistical Advisory & Training Service Pty Ltd
The data are ordered down column 1 first, so we need to set up Y as (6, 5, 4, 3, 2, 1, 6, 5, …)
and X as (1, 1, 1, 1, 1, 1), …, (8, 8, 8, 8, 8, 8) by right-clicking on each column and selecting
Fill (with the Starting Value for Y being 6, the Ending Value 1 and Increment -1).
.
The residuals in field position are:
Final_stratum_residuals
_['Column'] 1 2 3 4 5 6 7 8
_['Row']
6 -0.077 -0.027 -0.104 -0.066 -0.326 -0.130 -0.191 0.343
5 -0.157 -0.253 0.004 -0.054 0.190 0.099 -0.114 -0.770
4 0.434 0.047 0.470 -0.219 0.084 0.302 0.295 0.218
3 0.087 -0.222 0.079 0.124 0.093 -0.356 -0.324 0.141
2 -0.127 -0.142 0.350 -0.007 0.474 0.066 -0.654 -0.152
1 -0.175 -0.055 0.039 0.048 -0.140 0.012 0.284 0.555
These residuals should be random +/- across the field, since block effects are supposed to
have dealt with any gradient in the field. Within each block the residuals will add to 0. Given
that, deciding if the residuals are random in the field is fairly subjective. The accompanying
contour plot smoothes over the individual residuals, but again, deciding if the light areas
represent plots whose fitted counts are consistently larger than the observed counts is again
subjective.
122
Statistical Advisory & Training Service Pty Ltd
Final-stratum residuals
6
3
3
2
3
5
5
4 5
4
4
3 3
5
3 2
5
4
2
4 5
4
1
1 2 3 4 5 6 7 8
6: 0.4000
5: 0.2000
4: -0.0000
3: -0.2000
2: -0.4000
1: -0.6000
123
Statistical Advisory & Training Service Pty Ltd
Firstly, we reproduce the analysis of the eelworm Log(Final_Count) data. Recall that the
ANOVA Treatment Structure is Treated_Control/(Dose*Fumigant) and in a separate box a
covariate was defined. In LMM (REML), we move the covariate into the Fixed Model, which
becomes Log_Initial_Count+Treated_Control/(Dose*Fumigant).
The Random Model is Block+Block.Plot, or simply Block. Neither formulation allows us to use a
correlation structure spatially. We will discuss this issue after the basic REML analysis is
completed:
Deviance: -2*Log-Likelihood
Deviance d.f.
-30.98 36
REML estimates of the block and error variances are the same as the stratum variances. Once
a covariate is added, the main effects depend on the order the factors are entered into the
model (just as they would in the ANOVA). To illustrate this, we have removed the two factor
interaction from the fixed model. The change to the last part of the analysis is:
124
Statistical Advisory & Training Service Pty Ltd
Firstly, the field really consists of plots in a row by column layout. The original layout had
four blocks in a 2×2 layout with each block consisting of 12 plots in a 3×4 layout. As
hypothesized earlier, if there is a block effect, is it left to right across the field, or top to
bottom, or both? If any of these, why is the gradient no reflected in the plots within a block?
To investigate these possibilities, we inserted a factor labelled Y with 6 levels, and a factor
labelled X with 8 levels. The Y factor is filled from 6 down to 1 in order for the field layout to
mimic the X-Y coordinate system with the original in the bottom left hand corner of the field.
The Random Model is then X.Y with at most an AR2 ⊗ AR2 spatially correlated model. We do
not expect exactly the same scaled Wald statistics as before, since the assumed error structure
is now different.
We can use change in deviance to check whether we a less complex model is adequate.
It would appear that an AR1 correlated model left to right is what is required in this case. The
analysis is as follows.
125
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
-33.76 36
Means, all s.e.d. and l.s.d. values are suppressed: they can be saved into an Excel file.
126
Statistical Advisory & Training Service Pty Ltd
Multi-site experiments
Location df Residual MS
Plymouth 22 24149
Clayton 22 12124
Clinton 22 22851
Average 66 19708
Next, locations are really included to make better breeding choices, so interest lies in
interpreting the Strain.Location interaction. Technically, locations are fixed sites of interest and
each site is unreplicated (as are blocks at each location). Hence, to place Location in a top-
level stratum of its own (with no P value for Location) we place in the Block Structure rather
127
Statistical Advisory & Training Service Pty Ltd
than in the Treatment Structure, simply as a device. (In the LMM (REML) section for this
example we assume Strain and Strain.Location are both random factors.)
Next, block 1 at one location is not the same as block 1 at a different location. Hence we need
to combine blocks within locations, thereby obtaining (3-1)×3 = 6 df.
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Location.Block.*Units* stratum
Strain 11 925090. 84099. 4.27 <.001
Location.Strain 22 532900. 24223. 1.23 0.256
Residual 66 1300723. 19708.
…
Tables of means
Variate: Yield
128
Statistical Advisory & Training Service Pty Ltd
Notice that the Location.Block MS (11543) is unexpectedly smaller than the Residual MS
(19708) which gives rise to the negative variance component above. When then data are
analysed using LMM (REML), it is advisable to force a zero bound for this variance
component.
The Location MS is much larger than the Residual MS, indicating large variation in the overall
mean yields over the three locations. Differences in means between the strains, however, are
consistent across these locations (P=0.256).
Placing Location in the Block Structure was purely a device to prevent the unreplicated factor
Location from having a P-value printed in the ANOVA. The same analysis is produced when
Location is placed in the Treatment Structure, but no stratum variance is obtained then
(GenStat treats factors in the Treatment Structure as fixed terms).
Generally, when a factor is regarded as random then any interaction involving that factor is
also random. With the Steel and Torrie data it is unclear whether the three locations, or the
twelve strains, were randomly chosen or were of specific interest. It is common that Strains,
and hence Strains.Location, are random, and that is what we will assume (with Location fixed).
What often occurs, moreover, is that the residual variances differ across locations. This was
tested on page 102 via Bartlett’s test of homogeneity of variance (and found to be not
significant). Here we test it by change in deviance.
129
Statistical Advisory & Training Service Pty Ltd
Firstly, we test whether the residual variances at each location are the same:
So, the simpler model with a constant residual variance at each location suffices (P = 0.423).
The estimated variances (below) at each location are slightly different to those used in
Bartlett’s test in the design section, because in this analysis we constrained the Location.Block
term to be non-negative:
Deviance: -2*Log-Likelihood
Deviance d.f.
1172.04 101
130
Statistical Advisory & Training Service Pty Ltd
Clearly there are yield differences across locations (P<0.001), but this is neither surprising
nor of interest. As a breeding trial, we are more interested in strain differences. However, we
need to determine firstly whether there are genotype × environment interactions.
This result indicates that strain differences are consistent across locations (P = 0.475).
Are there any differences among the strains themselves? Since Strain is also a random effect,
we can only decide this by change in deviance. We take the no interaction model and drop
Strain:
Strain differences are strongly significant (P<0.001). The final analysis we use excludes the
Location.Strain interaction but includes the Block.Location random effect to emphasise the
combined nature of the analysis.
Deviance: -2*Log-Likelihood
Deviance d.f.
1172.55 102
131
Statistical Advisory & Training Service Pty Ltd
A combined analysis of separate experiments can be obtained using the meta analysis menu
in one step. Note that this menu assumes you want separate variances for each experimental
site:
The next question is how to estimate strain effects or strain means. GenStat provides Best
Linear Unbiased Predictor (BLUP) means and/or effects for random terms using the Save
menu. Before looking at these, what are they? For the following discussion we are indebted
to Keith Boldman (Global Data Analysis Methods, Monsanto Company, Iowa).
A BLUP estimate applies to random effects only. The Strain effect technically has a mean of
zero, and a variance of σ 2s say. However, we really wish to predict the genotype mean for
each strain. Write the current model (omitting the random term Location.Block which has a
zero variance and hence can be dropped from the model) as
At one extreme, we could use the ith sample mean as an estimate of (µ + stain effect) for the
ith strain. This is appropriate when Strain is fixed, and is known as the Best Linear Unbiased
Estimator (BLUE). This estimate is unbiased but may have a relatively large variance.
132
Statistical Advisory & Training Service Pty Ltd
At the other extreme, with no genetic variance, the grand mean is the appropriate estimator
for every strain. For our data, we have a genetic variance σ 2s which is significantly different
to 0.
where r is the number of replicates of each strain and σ2 is the residual variance. For our data,
h2 = 7095/(7095+20243/9) = 0.76. This ratio is applied to the deviations (differences between
strain sample means and the grand mean). This reduces the various deviations, giving rise to
BLUP effects and hence BLUP means. They are consequently “shrunk” toward the grand
mean.
The BLUP effects and BLUP means were captured using Save in GenStat. Select to display
the possible random terms. Double click on the random term whose BLUPS you wish to save
(in this case Strain). The reduction in the following table is h2×(deviation from grand mean):
this reduction is added to the grand mean to produce the BLUP mean.
ranking ranking
Sample deviation from BLUP on sample on BLUP
Strain mean grand mean h2×deviation Mean mean mean
Centennial 1395 -8.47 -6.43 1397 8 8
D74-7741 1406 3.19 2.43 1406 5 5
N72-137 1484 80.64 61.23 1464 3 3
N72-3058 1331 -72.58 -55.11 1348 11 11
N72-3148 1566 162.75 123.57 1527 1 1
N73-1102 1501 98.19 74.56 1478 2 2
N73-693 1436 32.97 25.04 1428 4 4
N73-877 1403 0.08 0.06 1403 6 6
N73-882 1397 -6.58 -5.00 1398 7 7
R73-81 1374 -29.47 -22.38 1381 9 9
R75-12 1176 -227.36 -172.63 1231 12 12
Tracy 1370 -33.36 -25.33 1378 10 10
In this example, no strain has a different ranking on the basis of sample and BLUP means.
133
Statistical Advisory & Training Service Pty Ltd
Calves were randomly allocated to receive treatment A or B (30 calves per treatment). The
weight of each calf was recorded 11 times (0, 2, 4, ..., 18, 19 wks). The first 3 calves in each
treatment are as follows. Data are from Diggle (1983).
Treatment A Treatment B
Calf: Calf:
Week 1 2 3 ... 1 2 3 ...
0 233 231 232 210 230 226
2 224 238 237 215 240 233
4 245 260 245 230 258 248
6 258 273 265 244 277 277
8 271 290 285 259 277 297
10 287 300 298 266 293 313
12 287 311 304 277 300 322
14 287 313 319 292 323 340
16 290 317 317 292 327 354
18 293 321 334 290 340 365
19 297 326 329 264 343 362
The trend in mean calf weights is similar for the two treatments, although mean calf weights
for treatment B are consistently below those for treatment A until about week 13.
340
B
320
A
300
Average weight
280
260
240
220
200
0 2 4 6 8 10 12 14 16 18 20
Week
There is considerable variation in the weights at any week, and there is a suggestion that the
variation increases over time (see the following plot for individual calf weights for treatment
A). The means and variances over time are as follows. The variance at week 19 is four to six
times larger than at birth.
134
Statistical Advisory & Training Service Pty Ltd
Week
0 2 4 6 8 10 12 14 16 18 19
Treatment means
A 226 230 247 266 281 295 305 313 315 324 325
B 225 228 244 263 276 290 299 318 320 327 320
variances
A 106 155 165 185 243 284 307 341 389 470 445
B 105 108 147 198 218 250 248 234 287 405 599
375
Calf weight, treatment A
325
275
225
175
0 2 4 6 8 10 12 14 16 18 20
Week
There are several ways you could analyse these data, but we will use the data to demonstrate
various uses of REML for repeated measurements data.
Firstly, an old-fashioned ANOVA of the data would use time as a split-treatment in a split-
plot experiment, with calves randomly assigned to one of two whole-plot treatments – thus, a
CRD split-plot experiment. Of course this assumes constant variance over time (which
appears an incorrect assumption). A split-plot also assumes that the split-units are also
randomised, which for time is not possible. Since for each calf its weight at each time is in
the same whole-plot, we have seen with a randomised block that this is equivalent to a
uniform correlation structure over time.
Here is the split-plot output, ignoring any problems with the assumptions:
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Calf.Treatment stratum
Treatment 1 455.01 455.01 0.20 0.658
Residual 58 133127.50 2295.30 35.37
Calf.Treatment.Week stratum
Week 10 846141.94 84614.19 1303.90 <.001
Treatment.Week 10 2264.16 226.42 3.49 <.001
Residual 580 37637.90 64.89
135
Statistical Advisory & Training Service Pty Ltd
Before the advent of modern computers, statisticians developed tests of whether a uniform
correlation structure (labelled “symmetry of the covariance matrix”) is appropriate over time.
When this assumption failed, an adjustment to the ANOVA is made by modifying the
degrees of freedom in the split-plot part of the ANOVA. GenStat offers this in the Stats >
Repeated Measurements > Analysis of Variance menu.
Greenhouse-Geisser epsilon
epsilon 0.2416
Analysis of variance
Variate: Week0,Week2,Week4,Week6,Week8,Week10,Week12,Week14,Week16,Week18,Week19
Subject stratum
Treatment 1 455.01 455.01 0.20 0.658
Residual 58 133127.50 2295.30 35.37
Subject.Time stratum
d.f. correction factor 0.2416
Time 10 846141.94 84614.19 1303.90 <.001
Time.Treatment 10 2264.16 226.42 3.49 0.025
Residual 580 37637.90 64.89
Again, this approach assumes constant variance, which for plants and animals growing over
time is unlikely.
There is a menu in GenStat which analyses CRD repeated measures data using REML. The
data can be arranged in separate columns for separate times, or stacked.
136
Statistical Advisory & Training Service Pty Ltd
Enter the columns of data (if unstacked). The Time Points are for labels in the output. The
default correlation structure is uniform, which as we have seen is equivalent to a CRD split-
plot with calf weights uniformly correlated over time. Therefore for this correlation structure
it does not matter whether the time points are equally spaced or not.
%_subject Identity - - -
%_Time Uniform theta1 0.7576 0.0368
137
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
3581.85 636
As can be seen:
The Wald F statistics and df are the same as those from the CRD split-plot ANOVA.
The estimate Sigma2 (267.7) is the total variance in the experiment. In the earlier
ANOVA we selected to display stratum variances, of which there were two:
Calf.Treatment (202.764) and Calf.Treatment.Week (64.893) so the total variance is
202.764+64.893 = 267.657.
The whole-plot error variance can be reconstructed from the total variance and from
the estimate of the uniform correlation (theta1), as we have seen before:
0.7576×267.657 = 202.8.
We saw that the variance was much larger at week 19 compared to at birth. REML allows the
variance to change across time (Allow heterogeneity across time). The two models are compared
using change in deviance:
Deviance d.f.
Constant variance model 3581.85 636
Changing variance model 3421.05 626
Change 160.8 10 <0.001
138
Statistical Advisory & Training Service Pty Ltd
Deviance: -2*Log-Likelihood
Deviance d.f.
3421.05 626
These variances do increase with time, but they are not very close to the sample variances in
all cases. By way of comparison, the average variances across treatments at each time are as
follows:
0 2 4 6 8 10 12 14 16 18 19
105.4 131.8 156.2 191.7 230.3 267.1 277.4 287.4 338.1 437.4 521.6
The heterogeneity assumption says that the change in variance is consistent across treatments;
possibly it should change with treatment. More probably, the uniform correlation assumption
does not hold. Weights closer together are almost certainly more highly correlated than
weights distant in time.
A simple model to explore is an AR1 structure (the autocorrelation model that applied to the
beaver data). However, an AR1 model needs equally spaced time points. When you untick
this option, AR1 and AR2 structures are no longer available. The available choices are:
139
Statistical Advisory & Training Service Pty Ltd
Unstructured
The whole variance-covariance matrix is estimated. It has no particular structure. It is
equivalent to a multivariate CRD analysis with the weights at various times as the
variates.
We commence with the unstructured model. For 11 time points there will be an 11 × 11
covariance matrix to print out. This involves 55 different parameter estimates. GenStat uses v
(for variance or covariance) with the row number first and the column number last. So v_11
is the top corner element of the variance matrix (row 1, column 1) and is the variance at time
1; v_12 is the covariance between times 1 and 2; ... to v_1111 which is the bottom corner
element of the variance matrix (row 11, column 11) and hence is the variance at time 11.
If you select the option Covariance Model, GenStat will rearrange these as a matrix, at least
for the first 10 rows; we have added the final row below:
1 105.4
2 98.8 131.8
3 102.4 132.2 156.2
4 95.2 136.8 160.3 191.7
5 101.6 142.7 166.9 198.0 230.3
6 104.6 147.0 175.1 210.5 237.7 267.1
7 96.5 132.5 162.8 199.6 227.6 257.5 277.4
8 100.0 141.1 169.2 204.4 231.9 261.4 265.4 287.4
9 107.0 143.8 171.8 209.9 244.8 277.7 285.4 300.5 338.1
10 102.2 147.0 178.8 218.3 250.4 288.1 287.9 309.0 348.0 437.4
11 107.0 144.8 184.2 227.2 250.4 291.3 297.2 313.3 353.9 452.3 521.6
1 2 3 4 5 6 7 8 9 10 11
You can confirm from the table on the previous page that the diagonal elements are simply
the average variances across time for the points.
To convert these to a correlation matrix requires diving the covariances (the off-diagonal
elements) by the appropriate two standard deviations. Thus, the correlation between the
weights at weeks 0 and 2 is 98.8/SQRT(105.4×131.8) = 0.838. The full 11×11 unstructured
correlation matrix for the weights over time is as follows:
140
Statistical Advisory & Training Service Pty Ltd
Would a power model be a good approximation to this? The correlations alongside 1 in the
unstructured correlation matrix are the lag-1 correlations (i.e. the correlations between the
weights at each time and the next time); they range from 0.838 to 0.964. Suppose that 0.9 is
the overall lag-1 correlation. Then the lag-2 correlation would be 0.92 = 0.81 under a power
model, and so on. This is the pattern:
Lag 1 2 3 4 5 6 7 8 9 10
corr 0.90 0.81 0.73 0.66 0.59 0.53 0.48 0.43 0.39 0.35
The patterns are not too dissimilar, perhaps the individual lag-correlations in the matrix tend
to be higher than the patterned power structure. The actual estimated power model (with no
additional uniform correlation with subjects, but with changing variances over time) is as
follows; phi_1 is the overall estimated lag-1 correlation:
%_subject Identity - - -
%_Time Power(1) het phi_1 0.9583 0.0061
Scale row 1 133.9 23.6
Scale row 2 154.5 26.5
Scale row 3 155.0 25.7
Scale row 4 166.5 27.2
Scale row 5 180.5 28.9
Scale row 6 200.7 32.0
Scale row 7 210.8 34.0
Scale row 8 225.2 36.1
Scale row 9 291.8 47.2
Scale row 10 429.7 70.4
Scale row 11 524.3 86.3
The variance estimates (in bold) are not all close to the average sample variances (in order
105.4, 131.8, 156.2, 191.7, 230.3, 267.1, 277.4, 287.4, 338.1, 437.4, 521.6), so perhaps the
model is not a good fit. Since the power structure is a special case of the unstructured model
(the 55 individual correlations are replaced by (powers of) a single correlation, we use the
change in deviance to determine the adequacy of fit. The df will be 55-1 = 54:
141
Statistical Advisory & Training Service Pty Ltd
The antedependence model is designed to be close to the unstructured model, and involves
far fewer parameters. Firstly, we check whether order 1 or order 2 is necessary:
The order 2 model is statistically better than the order 1 model. What do these look like?
The covariance matrix for the antedependence structure, C say, is defined as a function of a
diagonal matrix D and a matrix U which has elements all zero apart from the diagonal
elements (which are all 1) and, for the order 1 structure, one off diagonal element to the right
alongside each diagonal element. For an order 2 structure, U has two off diagonal elements to
the right alongside each diagonal element. Specifically, C = (U D-1 UT)-1. GenStat produces
the inverses of the diagonal elements of D (which are labelled dinv_1, dinv_2, ...) and the
non-zero elements of U.
Hence, for an order 1 structure over t time points, there are t+(t-1) = 2t-1 parameters to
estimate (so 21 with 11 time points); for an order 2 structure over t time points, there are
t+(t-1)+(t-2) = 3(t-1) parameters to estimate (so 30 with 11 time points).
The antedependence structure is a special case of the unstructured model, for which there are
t(t+1)/2 parameters to estimate (so 66 with 11 time points). The change in deviance for
comparing an unstructured model with an antedependence order 2 structure will therefore
have (t-2)(t-3)/2 df (so 36 for 11 time points):
The antedependence order 2 model, with 36 fewer parameters, is not a significantly worse
model than the unstructured model (P=0.331). However the power model (with variances
changing across time) involves ever fewer parameters: 11 time variances and 1 correlation
coefficient for a unit time difference. Since the power model is not a special case of the
antedependence model, we cannot use change in deviance to compare them. GenStat offers as
an option two coefficients that can be used in this situation.
142
Statistical Advisory & Training Service Pty Ltd
These coefficients are both related to the deviance. As stated, they do not represent a formal
test of two competing models, they are simply tools for model selection. The lower their
value the less information is lost and the better the model is. GenStat offers these as options
in the LMM (REML) menu.
The AIC and SC values for the power model with changing variances are 4243.89 and
4301.87; for the antedependence order 2 model they are 4320.50 and 4329.41, which are
larger by 76.61 and 27.54 units respectively. The difference is largely because the power
model involves fewer parameters, so is a trade off between the deviance and the number of
parameters fitted. On the AIC and SC alone the power model appears the better choice.
However, the change in deviance suggested the power model is not a good fit to the
unstructured model, whereas the antedependence order 2 model is. The output for this model
is:
%_subject Identity - - -
%_Time Antedependence(1)
dinv_1 0.009486 0.001778
dinv_2 0.02549 0.00479
dinv_3 0.04245 0.00790
dinv_4 0.03680 0.00684
dinv_5 0.03874 0.00723
dinv_6 0.04578 0.00850
dinv_7 0.03439 0.00643
dinv_8 0.02994 0.00558
dinv_9 0.04200 0.00780
dinv_10 0.01263 0.00235
dinv_11 0.01855 0.00344
u_12 -0.9370 0.0809
u_23 -1.003 0.056
u_34 -1.026 0.056
u_45 -1.033 0.049
u_56 -1.032 0.041
u_67 -0.9642 0.0446
143
Statistical Advisory & Training Service Pty Ltd
V(y) = Sigma2.R
Factor: %_Time
Model: Antedependence
1 105.4
2 98.8 131.8
3 99.1 132.2 156.2
4 101.7 135.7 160.3 191.7
5 105.0 140.1 165.6 198.0 230.3
6 108.4 144.6 170.8 204.3 237.7 267.1
7 104.5 139.4 164.7 197.0 229.2 257.5 277.4
8 100.0 133.4 157.6 188.5 219.3 246.4 265.4 287.4
9 104.6 139.5 164.8 197.1 229.3 257.7 277.6 300.5 338.1
10 107.6 143.6 169.7 202.9 236.0 265.2 285.7 309.3 348.0 437.4
1 2 3 4 5 6 7 8 9 10
Deviance: -2*Log-Likelihood
Deviance d.f.
3005.67 617
One of the benefits of choosing an appropriate variance matrix over time is the appropriate
precision for comparing treatment means at any time, or the difference in means for a
particular treatment over time. A split-plot in time analysis assumes constant variance. For
such an analysis, the same (inappropriate) sed value is used. Here are the means and sed
values from the antedependence order 2 model:
144
Statistical Advisory & Training Service Pty Ltd
Finally, we compare the variance matrix across time for the antedependence order 2 and
unstructured models. You can see the variance estimates are the sample variances across time
for both models. The covariances are identical to lag-2 (apart from the occasional round off
error), and are not too different beyond lag-2.
145
Statistical Advisory & Training Service Pty Ltd
Snedecor and Cochran presented an analysis of asparagus yields taken from an experiment in
which planting occurred in 1929 and cuttings commenced in 1930. Data are available for four
years from the same plots. This was a randomized block, with four plots in each block. The
four plots corresponded to cuttings taken on June 1 each year, but for three of the plots
additional cuttings were taken (but not analysed). The intent of the analysis was to detect if
repeated cutting of asparagus affected plant vigour.
Example 21 Asparagus yields from four annual cuttings, from Snedecor and Cochran, page
330-2.
Year
Block Cutting ceased 1930 1931 1932 1933
Jun-01 230 324 512 399
Jun-15 212 415 584 386
1
Jul-01 183 320 456 255
Jul-15 148 246 304 144
Jun-01 216 317 448 361
Jun-15 190 296 471 280
2
Jul-01 186 295 387 187
Jul-15 126 201 289 83
Jun-01 219 357 496 344
Jun-15 151 278 399 254
3
Jul-01 177 298 427 239
Jul-15 107 192 271 90
Jun-01 200 362 540 381
Jun-15 150 336 485 279
4
Jul-01 209 328 462 244
Jul-15 168 226 312 168
Clearly, the same plot is repeatedly measured, and hence yields for the same plot are most
likely correlated across years.
Snedecor and Cochran overcame that problem by (a) an analysis of total annual yields, and
(b) an analysis of the linear yield component over years (using multipliers -3, -1, 1, 3), which
was (then) a way of overcoming the correlated nature of the data.
If you believe that the correlation structure over time was uniform, a split-plot RCBD would
be appropriate (and would be the correct analysis if only two years were involved). This
analysis is:
146
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Source of variation d.f. s.s. m.s. v.r. F pr.
Block.CuttingTime stratum
CuttingTime 3 241376.6 80458.9 33.12 <.001
Residual 9 21860.8 2429.0 5.65
Block.CuttingTime.Year stratum
Year 3 518721.9 172907.3 401.94 <.001
CuttingTime.Year 9 51177.5 5686.4 13.22 <.001
Residual 36 15486.6 430.2
Total 63 878793.0
The analysis of the asparagus yields is an example of the need for a temporal correlation
model for plots measured annually. Since the years were equally spaced, AR, antedependence
and unstructured models are potential correlation models.
Recall that for a randomised block with blocks random, the random model is
Block+Block.Plot
and this can be replaced by Block.Plot with a uniform correlation structure for the plots.
In the split-plot case, the split-plot treatment (Year) will be explored for an appropriate
correlation structure. So by analogy with the RCB case, we work backwards and replace the
last two random terms (Block.Whole_Plot + Block.Whole_Plot.Split_Plot) by a single term
Block.Whole_Plot.Split_Plot with a uniform correlation structure on the split-plot units.
For the example, CuttingTime is the whole-plot treatment and Year the split-plot treatment,
and we can use these factors in lieu of the unit names in the random model. Hence the split-
plot ANOVA should be equivalent to a REML analysis with:
147
Statistical Advisory & Training Service Pty Ltd
Block Identity - - -
CuttingTime Identity - - -
Year Uniform theta1 0.5374 0.1592
Deviance: -2*Log-Likelihood
Deviance d.f.
386.30 45
148
Statistical Advisory & Training Service Pty Ltd
The estimate of the variance of the random block effect (476.7) is the same as the
Block stratum variance from the ANOVA.
The estimate Sigma2 (929.9) is the total variance of the two terms replaced in the
REML with a uniform structure, ie the whole-plot error and the split-plot error, From
the ANOVA, the two stratum variances were 499.70 and 430.18 respectively, and
these add to 929.88.
The estimate of the Block variance in an RCB was reconstructed by multiplying the
uniform correlation by the total variance, so here the whole-plot error is simply
0.5374×929.88 = 499.71. This is the same as the whole-plot stratum variance from the
ANOVA.
Years are equally spaced, and changing to an AR1 correlation structure over years (plus a
random block effect) produces a similar size deviance (compared to uniform; we can’t test
the deviances for these two models as one is not a special case of the other). An AR2
structure is certainly unnecessary for these data (P=0.498). With an AR1 model, there also
appears to be no need to have the variance change across years (P=0.440):
When we try and fit an unstructured model over time the estimate of the block variance
becomes negative; when constrained to be positive the deviance is 370.10 with 37 df. Hence,
the AR1 model is a statistically acceptable model in comparison to the unstructured model
(change in deviance = 12.67 on 8 df, P=0.124) and involves 8 (or 7 if Block is omitted) fewer
parameters.
The antedependence order 2 model is not a significantly better model than the order 1 model
(P=0.827) on the basis of the following change in deviance:
Here is the full output from the antedependence model. The superiority of this model
compared to the split-plot in time (uniform) model lies in the precision for comparing the
149
Statistical Advisory & Training Service Pty Ltd
cutting time means within and across years. For the latter model, the sed for a comparison
between a particular cutting time mean for any two years is 14.7; for comparing any two
cutting time means in a particular year, or across years, is 21.6. For the antedependence order
1 model, the 14.7 common sed is replaced by a range of sed values whose minimum is 11.2
and whose maximum is 20.1; the 21.6 sed is replaced by a range of sed values whose
minimum is 11.2 and whose maximum is 30.73. The maximum value applies to a comparison
with 1932, a year in which both yields and the estimated variance were high.
Block Identity - - -
CuttingTime Identity - - -
Year Antedependence(1)
dinv_1 0.002333 0.001056
dinv_2 0.001157 0.000480
dinv_3 0.002082 0.000852
dinv_4 0.002011 0.000830
u_12 -0.7185 0.4525
u_23 -1.139 0.196
u_34 -0.6786 0.1554
150
Statistical Advisory & Training Service Pty Ltd
Scalar s: 86.00
Factor: Block
Model: Identity ( 4 rows)
Factor: CuttingTime
Model: Identity ( 4 rows)
Factor: Year
Model: Antedependence
151
Statistical Advisory & Training Service Pty Ltd
CuttingTime Jun_01 1 *
CuttingTime Jun_15 2 20.4 *
CuttingTime Jul_01 3 20.4 20.4 *
CuttingTime Jul_15 4 20.4 20.4 20.4 *
1 2 3 4
Year 1930 1 *
Year 1931 2 7.5 *
Year 1932 3 10.0 5.6 *
Year 1933 4 9.1 7.0 6.6 *
1 2 3 4
Average: 7.626
Maximum: 10.05
Minimum: 5.598
152
Statistical Advisory & Training Service Pty Ltd
Average: 22.32
Maximum: 30.73
Minimum: 11.20
CuttingTime Year
241.7 596.2
153
Statistical Advisory & Training Service Pty Ltd
There are two choices to make for the Covariance model across data. The first, Identity, simply
assumes that the time variates are uncorrelated; a different variance will be fitted for each
variate, hence the variance matrix fitted is Diagonal. The second will be shown to produce one
of the MANOVA test statistics. As usual, we use change in deviance to decide between the
two models.
There is overwhelming evidence that the data are correlated over time. The variances and
covariances from this analysis were presented previously, as well as the reconstructed
correlation matrix. (Remember that GenStat labels these v_11, v_12, v_22, ... in a long list in
the output. Choose to show the Covariance Model to have them printed out in (lower
triangular) matrix form, at least for up to 10 rows.
154
Statistical Advisory & Training Service Pty Ltd
1 105.4
2 98.8 131.8
3 102.4 132.2 156.2
4 95.2 136.8 160.3 191.7
5 101.6 142.7 166.9 198.0 230.3
6 104.6 147.0 175.1 210.5 237.7 267.1
7 96.5 132.5 162.8 199.6 227.6 257.5 277.4
8 100.0 141.1 169.2 204.4 231.9 261.4 265.4 287.4
9 107.0 143.8 171.8 209.9 244.8 277.7 285.4 300.5 338.1
10 102.2 147.0 178.8 218.3 250.4 288.1 287.9 309.0 348.0 437.4
11 107.0 144.8 184.2 227.2 250.4 291.3 297.2 313.3 353.9 452.3 521.6
1 2 3 4 5 6 7 8 9 10 11
There is a highly significant difference between the treatment A set of calf weight means and
the treatment B set (P<0.001). The means, all s.e.d. and l.s.d. values are suppressed in this
section.
The MANOVA is obtained in Stats > Multivariate Analysis > MANOVA. In Options you can
choose to have the sums of squares and products matrices printed out – these are the variance
matrices for treatments and residual. You can also choose to have separate ANOVAs printed
(AOV Table). This is appropriate if the data are uncorrelated over time, and essentially
performs all the ANOVA in one step.
155
Statistical Advisory & Training Service Pty Ltd
For the calf data the sums of squares and products matrices are as follows:
SSP matrices
Treatment
(Lower triangular part of each matrix is shown here, for times 0, 2, 4, …, 18, 19):
0 38.4
2 58.4 88.8
4 80 121.7 166.7
6 75.2 114.4 156.7 147.3
8 113.6 172.8 236.7 222.5 336.1
10 113.6 172.8 236.7 222.5 336.1 336.1
12 132 200.8 275 258.5 390.5 390.5 453.8
14 -115.2 -175.2 -240 -225.6 -340.8 -340.8 -396 345.6
16 -108.8 -165.5 -226.7 -213.1 -321.9 -321.9 -374 326.4 308.3
18 -68.8 -104.6 -143.3 -134.7 -203.5 -203.5 -236.5 206.4 194.9 123.3
19 120 182.5 250 235 355 355 412.5 -360 -340 -215 375
0 2 4 6 8 10 12 14 16 18 19
Degree of freedom: 1
156
Statistical Advisory & Training Service Pty Ltd
Residual
0 6114
2 5729 7643
4 5938 7667 9057
6 5521 7933 9296 11116
8 5891 8276 9681 11483 13360
10 6065 8527 10157 12210 13785 15491
12 5595 7686 9440 11575 13200 14936 16087
14 5800 8182 9815 11856 13451 15161 15394 16668
16 6205 8343 9967 12176 14200 16108 16554 17430 19608
18 5929 8525 10372 12663 14524 16712 16697 17925 20183 25368
19 6205 8400 10686 13180 14524 16897 17235 18169 20529 26232 30253
0 2 4 6 8 10 12 14 16 18 19
Degree of freedom: 58
If you look at say the first ANOVA, you will see that the diagonal terms of the matrices are
simply the Treatment SS (38.4) and Residual SS (6114).
Analysis of variance
Variate: Week0
_units_ stratum
Treatment 1 38.4 38.4 0.36 0.548
Residual 58 6114.0 105.4
Total 59 6152.4
Notice that the Rao F statistic of 6.48 is the same as the test of treatment means across
variates in the Multivariate REML:
The means and s.e.d. values are printed out as an option, but not l.s.d. values. MANOVA is
also restricted to balanced data, so the REML approach has the advantage.
157
Statistical Advisory & Training Service Pty Ltd
The MANOVA is a simple extension of the CRD MANOVA – we simply set up the blocking
structure using the unstacked data:
In Version 12 of GenStat there is a warning which we can ignore, as it does not affect tests or
P values:
Residual
%1930 1800
%1931 2761 6904
%1932 4080 9801 14037
%1933 3860 9212 12994 12520
%1930 %1931 %1932 %1933
Degree of freedom: 3
Block._units_ stratum
158
Statistical Advisory & Training Service Pty Ltd
CuttingsCeased
%1930 12941
%1931 19944 38778
%1932 32417 63546 104969
%1933 38142 68034 114393 135867
%1930 %1931 %1932 %1933
Degree of freedom: 3
Residual
%1930 4144
%1931 2458 8363
%1932 3020 8000 12316
%1933 4012 4099 6004 7433
%1930 %1931 %1932 %1933
Degree of freedom: 9
Test statistics
Block._units_ stratum
Term d.f. Wilk's lambda Rao F n.d.f. d.d.f. F prob.
CuttingsCeased 3 0.009994 6.33 12 16 0.000
Again, notice that the Rao F test is highly significant (P<0.001) – remember we never use
0.000 in a report. This variance ratio should be the same as the multivariate REML using an
unstructured correlation matrix over time. Unfortunately, current versions of GenStat have a
problem estimating the variance matrix - the default steps in the iteration routine are too large
to lead to convergence - so we are unable to demonstrate the equivalence of the two analyses
at this stage.
and, if Time is unstructured for both random terms, the Rao F statistic of MANOVA will be
the same as the Wald F test for Treatment.Time in the multivariate REML.
In the MANOVA output, the diagonal elements of the sum of squares and products matrices
are simply the Block, Treatment and Residual sums of squares from the univariate ANOVAS.
For example, here is the ANOVA for 1930. The three sums of squares are the leading
element of the three matrices for Block, CuttingsCeased and Residual respectively:
159
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: %1930
Block._units_ stratum
CuttingsCeased 3 12941.0 4313.7 9.37 0.004
Residual 9 4144.5 460.5
Total 15 18886.0
The off-diagonal elements are the sum of products between the corresponding terms from
pairs of ANOVAs. The Residual matrix provides the estimated correlations of the data among
years. There are 9 df for each term in the matrix, so the variance matrix is:
460.4
273.1 929.2
335.6 888.9 1368.4
445.8 455.4 667.1 825.9
1
0.418 1
0.423 0.788 1
0.723 0.520 0.628 1
The correlation matrix from the antedependence model (with no Block.Year random term)
was similar, apart from the correlation between 1930 and 1933 data. (There are only 9 df for
variances and covariances, so this discrepancy is not unsurprising.)
1
0.45 1
0.39 0.86 1
0.31 0.69 0.80 1
160
Statistical Advisory & Training Service Pty Ltd
as s2, estimates σ2 s2 = i =1
n −1
The sample variance of y1 , K, yt estimates providing each mean comes from the same
numbers of replicates from a common
σ2/n distribution
In experimental work, one almost never knows the true population variance σ2, and hence it
needs to be estimated. This affects the distribution used in analysing experimental data.
t=
( y1 − y2 ) − ( µ1 − µ2 ) , where
Two-sample test statistics (we are usually
interested in µ1 - µ2= 0). When we are happy sed
2
to assume σ12 = σ 22 we use a pooled estimate s s2
sed = 1
+ 2 if σ12 ≠ σ 22 , df complex
of variance obtained as a weighted variance n1 n2
with df as weights:
1 1
sp =
2 ( n1 − 1) s12 + ( n2 − 1) s22 s 2p + if σ12 = σ 22 ,
n1 n2
( n1 − 1) + ( n2 − 1)
df = ( n1 − 1) + ( n2 − 1)
For more complex analyses the estimate of variance used is based on the appropriate stratum
variance (with appropriate degrees of freedom).
161
Statistical Advisory & Training Service Pty Ltd
Cultivar 2
Cultivar 3
Cultivar 4
Cultivar 2
Cultivar 4
Cultivar 1
Block 2
Block 3
Block 4
Block 2
Block 3
Block 4
162
Statistical Advisory & Training Service Pty Ltd
Random sampling is important to remove bias and to allow the parameters (mean, standard
deviation, and so on) of the distribution from which the sample is drawn to be estimated. The
more replicates you can provide, the more accurate will be your estimates. How many
replicates to provide is often the most difficult question to answer: as we will see, we need (a)
some idea of the anticipated variation in our data, as well as (b) an understanding of how
large a difference we are hoping to demonstrate, before a decision can be made. When it
comes to designing an experiment, GenStat will always provide a random plan for the
experiment: a “blueprint” that can be used in the field. The plan is a simple spreadsheet
which we augment with the data available, and analyse by simple point and click.
Treatments can only be compared if they are properly replicated. Suppose you prepare four
demonstration plots and sow out four cultivars, one in each plot (Scenario 1). You cannot
then compare the yields from these plots, even if you obtain several sampling areas from each
plot (Scenario 2). The cultivars are not replicated. Any differences in total yield could well be
accidental location differences; there is no way of separating out the cultivar effects and the
location effects.
Often you perform a number of randomisations in the field, leading to differently shaped
experimental units. Treatments can only be compared using replicates of the same shape. We
call these different shapes strata.
i) An experimental unit is the smallest amount of experimental material that one treatment
is randomised to.
ii) A sampling unit is the smallest amount of experimental material that is actually
measured.
iii) Experimental units are used in forming tests of particular treatments. Sampling units just
measure how “uniform” the experimental material is, and provide no degrees of freedom
for these tests.
Basically, the way you design your experiment affects the way you analyse your data.
Scenario 3 is a properly replicated trial, with each cultivar sown out in different areas.
Replicates are ¼ block shapes. Blocks form one stratum (and blocks are not replicated, so
strictly cannot be tested) and plots in a block form a second stratum.
Scenario 4 is also properly replicated trial. However, the blocks (stratum 1) are first divided
into two large areas (stratum 2) and different cultivation techniques applied to these two
areas. Cultivars are applied to smaller plots (stratum 3) within these areas, thereby affecting
the way we analyse the data, as we will see.
163
Statistical Advisory & Training Service Pty Ltd
GenStat has the ability to generate a random design for you. Most of the common designs are
available, including incomplete factorial designs, and designs with additional replication for
(say) a control treatment.
The design is a blueprint for conducting the experiment. It assigns the treatments to
experimental units randomly. At the end of the experiment, add your data to the spreadsheet
and, at least for normally or log-normally distributed data, all you need to do is point and
click to have the analysis performed.
Firstly, let’s illustrate the method with a simple one-way treatment design with four cultivars
of oats (Vicland (1), Vicland (2), Clinton and Branch), set out in three randomized blocks in
the field.
Use Stats > Design > Generate a Standard Design. Choose One-way Design (in Randomized
Blocks). Name the treatment factor and (optionally) the units to which the treatments are to be
applied. Indicate the number of blocks and levels. In Options, you can Trial ANOVA with
random data: this produces an analysis of random data, scaled so that the Residual MS is
always 1.
GenStat creates a spreadsheet and outputs the analysis. Notice the following:
The first column is a key to the plots in the field. The second integer is the block number,
the first integer the plot number in that block. GenStat will use as many digits as required.
Thus, for a design with 12 treatments in 3 blocks, the first two columns will indicate plots
and the final column the block.
164
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: _Rand_
Block.Plots stratum
Cultivar 3 6.448 2.149 2.15 0.195
Residual 6 6.000 1.000
Total 11 26.421
Tables of means
Variate: _Rand_
Cultivar 1 2 3 4
22.94 21.05 21.36 21.41
165
Statistical Advisory & Training Service Pty Ltd
GenStat will always generate a factor column for every stratum in the experiment. We have
seen that for a block design, blocks, while unreplicated, form one stratum, and plots (which
provide the replication for treatment comparisons) form the second stratum.
The final column indicates which treatment to use in each plot in the field. This is the
field plan. It is preferable at this stage to edit the column attributes (F9 is the shortcut). In
this case, change the 1, 2, 3, 4 for cultivars to their actual names. These names are then
part of your statistical analysis once the data become available.
Having entered the experimental data into the spreadsheet, you can simply right click (in this
example) on the PlotNo column in the spreadsheet, select Analysis > Analysis of Variance.
The necessary structure is completed for you: your only task is to choose which variate you
want analyzed this way.
The analysis will be like the one shown (which is for GenStat’s random, scaled data).
Before proceeding to other designs, we need to discuss the shortcuts that GenStat uses for
treatment and block structures.
166
Statistical Advisory & Training Service Pty Ltd
Consider the analysis of variance for a one-way treatment design, firstly for the unblocked
analysis and then for the randomized block analysis.
rep 7 6
mean 56.21 61.25
variance 9.015 5.299
Firstly, the sample variance of the 13 data values is 13.534. In the ANOVA table, this is the
Total MS, and equals 162.511/12. GenStat does not complete this entry in the table (except in
the regression menu).
The Residual SS (80.584) is the sum of squared residuals, (defined as observed – fitted). The
Residual MS turns out to be the pooled variance estimate, that is, a weighted average of the
individual treatment variances, with weights equal to the individual degreed of freedom of the
sample variances:
7.326 = (6×9.015+5×5.299)/(6+5)
Thus, under the null hypothesis that the means are equal, the ratio
F = Treatment MS / Residual MS is
For t treatments, the situation is no different. The mean squares are interpreted as follows.
To summarize:
167
Statistical Advisory & Training Service Pty Ltd
Analysis of variance
Variate: Concentration
Head.*Units* stratum
Vapor_Pressure 1 592.960 592.960 241.32 <.001
Residual 9 22.115 2.457
Total 19 731.189
The Total MS is still the sample variance of all the data. Thus, 731.189/19 = 38.484.
The Treatment MS is a weighted variance of the treatment means, the weights being the
number of blocks. The two vapor pressure means are 67.04 and 56.15. Each is based on
10 replicates. Thus, the Treatment MS is 10×sample variance of (67.04, 56.15) = 592.96.
The Block MS is a weighted variance of the block means, the weights being the number of
treatments. There are 10 block means, (57.1, …, 59.1) and each is based on two
observations, one from each treatment. Thus, the Block MS is 2×sample variance of (57.1,
…, 59.1) = 12.902.
The Block SS is still the sum of squares of the residuals. The Block MS is a Treatment ×
Block interaction: it measures the failure of the treatments to respond alike in each block.
To summarize:
168
Statistical Advisory & Training Service Pty Ltd
The principle underlying a correct formulation of the blocking structure is to properly declare
every type of experimental unit. For each stage of randomization a new experimental unit is
created. Since the analysis exactly mimics the way the experiment is conducted in the field, a
new stratum is created in the ANOVA table.
GenStat, however, allows you to omit the lowest level of randomization on the Block Structure
line. If you omit the lowest level stratum in Linear Mixed Models (REML), GenStat (tells
you that it) adds it to the model.
Block and treatment structures can be simplified using certain rules and operators.
Terms within parentheses are evaluated first. Otherwise, the order that GenStat uses to
evaluate formulae which include operators is as follows (see GenStat Reference Manual):
1. .
2. //
3. /
4. *
5. + - -/ -*
Generally we use . / * + and -. Formulae involving a mixture of operators of rank (5) are
computed left to right.
Let A, B, C … represent the names of factors and L and M a set of terms in a formula.
Sum of all pairwise combinations of terms in L with terms in M using
Rule 1 L.M the dot operator. For example:
(A+B).(C+D.E) is the same as A.C + B.C + A.D.E + B.D.E
L+M+L.M. For example:
Rule 2 L*M A*C is the same as A + C + A.C
(A+B)*C is the same as A + B + C + A.C + B.C
L+L.M where L is a term formed by combining all terms in L with the
dot operator. For example:
Rule 3 L/M
A/C is the same as A + A.C
(A+B)/(C+D.E) is the same as A + B + A.B.C + A.B.D.E
L without any terms that appear in M. For example:
Rule 4 L-M (A+B)-(A+C) is the same as B
A*B*C-A.B.C is the same as A+B+C+A.B+A.C+B.C
For an experiment with replication but no blocks, there should be a factor indexing the units
that form replicates (plots, pots, animals, …). If there is sub-sampling within the replicate,
provide an additional column to index those units. It is better to use Plot 1, 2, 3, … p rather
than Treatment 1 (Plot 1, 2, 3), Treatment 2 (Plot 1, 2, 3) and so on. The Block Structure for
this design can be left blank (as mentioned in paragraph 2 above), or written as Plot with the
first method of indexing plots, or Treatment.Plot with the second. For the Random Model: in
Linear Mixed Models (REML), there is an occasional advantage one way or another.
169
Statistical Advisory & Training Service Pty Ltd
Suppose we have 8 participants randomized into two groups and tracked over 4 months.
Next, suppose that Participant 7 dropped out of the trial after Time 0. This participant had an
initial value of 4.6, only a little below the group average of 6.28. The treated group means at
Times 1, 2 and 3 would not be expected to be very different from the ones above, provided
that Participant 7 did not respond unexpectedly. That is, if the participant in question
continued to have values just a little below the averages at these times, omitting these values
at Times 1, 2 and 3 would (be expected to) increase the means just a little at those times.
Sample means
Control 5.60 5.35 5.20 5.13
Treated 6.28 11.50 12.13 12.40
This is a simple repeated measures analysis, with each participant having repeated measures
at 4 times. We used a Linear Mixed Model (Residual Maximum Likelihood) analysis in
GenStat - we refer to this analysis as LMM (REML). We allowed the variance to change over
170
Statistical Advisory & Training Service Pty Ltd
time, and allowed for repeated data being correlated in an autoregressive order 1 (AR1) time
series - a power model when the times are unequally spaced.
What does such a LMM (REML) analysis produce? Here are the sample and REML means
with Participant 7 dropping out of the trial after Time 0:
You can see that the sample means with 3 missing values are adjusted downwards for the
treated group at times 1, 2 and 3, and are closer to what the original means were for the
complete set of data.
Next suppose that Participant 5 dropped out of the trial after Time 0. This participant had an
initial value of 12.9, a long way above the group average of 6.28. The treated group means at
Times 1, 2 and 3 would therefore be expected to be very different from the original sample
means, provided that Participant 5 did not respond unexpectedly. Since the participant had an
initial pressure a long way above the average, omitting his values at Times 1, 2 and 3 would
(be expected to) lower the means radically at those times. They would be very biased
estimates of the true means, since the “worst” performing participant is excluded at those
times.
Compare what happens when these three values are omitted, and what happens when we use
a LMM (REML) analysis as described above:
171
Statistical Advisory & Training Service Pty Ltd
You can see that the sample means with 3 missing values are adjusted upwards, and by a
long way, for the treated group at times 1, 2 and 3, and are closer to what the original means
were for the complete set of data.
172