University of Queensland MERCI Statistical Training Series
Spatial analysis in a linear mixed model framework
Alison Kelly Clayton Forknall Bethany Rognoni
June 23, 2023
Residuals from the BWNE22AN
Let's look at the relationship between the residuals
from the trial in another way.
Residuals from the BWNE22AN
Correlation between residuals in the Column direction, for all Rows (0.30).
1
Lag 1 Residuals
−1
−1 0 1
Residuals (t/ha)
Spatial methods of analysis
I In the 1980's there was a growing movement for spatial analysis of
eld trials, based on performance of neighbouring plots.
I It was based on the realisation that there was some relationship or
dependence between neighbouring plots in the eld (Williams, 1952)
I There were a lot of methods developed for spatial analysis,
(Wilkinson, 1983; Williams, 1985; Besag and Kempton, 1986;
Glesson and Cullis, 1987).
I We follow the approach of Gilmour et al. (1997), where smooth
spatial trend is modelled on the residuals as a correlation process.
Spatial methods of analysis
Smooth continuous trend
I We no longer make the assumption of IID errors, but adopt a more
complex variance structure for the residuals
I We estimate a correlation between plots, and allow this correlation
to decay with the distance between plots.
I We do this in a two-dimensional way; for the columns, and the rows
BWNE22AN example
I We again t Replicate and Genotype as random eects in a linear
mixed model using ASReml-R by specifying the following command.
I We also t r Row and Column as random eects in the linear mixed
model as we have balanced across the row and column dimensions in
the optimal design.
I In addition, we dene the two-dimensional layout of plots in the
eld, across the Row and Column dimensions.
[Link] <- asreml(fixed = yield~ 1,
random =~ Replicate + Genotype + Row + Column ,
residual =~ Column:Row ,
data = [Link])
BWNE22AN example: RCB model
The residual option is used to specify the residual term as Column:Row.
This implies that
I the number of eects in the Column:Row term must equal number
of data units
I each combination of levels of Column:Row must uniquely identify
one unit
I the data must be ordered to match the Column:Row structure
# sort data frame
[Link] <- [Link][order([Link]$Column,[Link]$Row),]
Spatial methods of analysis
We introduce a residual covariance structure that models correlation
between the plots. The baseline spatial model includes random eects for
all design terms, and also species a separable ar1xar1 process for the
residual across Columns and Rows
[Link] <- asreml(yield~ 1,
random=~ Replicate + Genotype + Row + Column ,
residual=~ar1(Column):ar1(Row),
data=[Link])
I The ar1 model is an autoregressive model of lag 1. It estimates the
correlation between the eld plots that are 1 plot apart
(side-by-side) in the direction of the factor term, (Row or Column).
Residuals from the BWNE22AN
Back to ASReml to t your rst spatial model.
Bread wheat NE trials 2022
A motivating example
I We now consider the spatial analysis of the set of 5 bread wheat
trials.
Trial Row Column Varieties Mean yield
BWNE22AN 18 10 60 4.74
BWNE22AT 18 10 60 2.57
BWNE22EN 18 10 60 4.07
BWNE22GR 18 10 60 1.29
BWNE22KU 18 10 60 4.21
Column
1
2
3
4
5
6
7
8
9
10
EBW194173 EBW192990 EBW192901 EBW192758 EBW192986 EBW212106 EBW192988 EBW192816 EBW192793 EBW182706
EBW192763 EBW182463 EBW224004 EBW213092 EBW150051 EBW192807 EBW213077 EBW224003 EBW184055 EBW192930
EBW192954 EBW213106 EBW192940 EBW192349 EBW192915 EBW192939 EBW192493 EBW224001 EBW224002 EBW193097
Spatial Analysis
Hawi EBW150047 EBW192938 Pavon−76 EBW192418 EBW193080 EBW192350 EBW192369 EBW193173 EBW213073
EBW194076 King bird EBW192924 EBW213087 EBW192361 EBW192931 EBW192789 Dursa EBW192907 EBW192406
EBW192929 EBW192945 EBW212138 EBW150062 EBW182714 EBW192927 EBW192922 EBW172714 EBW182623 ETBW9396
EBW192945 EBW194076 EBW150062 EBW192930 EBW192929 EBW182714 EBW192931 EBW192922 ETBW9396 Dursa
EBW192940 EBW212138 EBW193097 EBW192793 EBW192927 EBW192369 EBW192406 EBW192763 EBW192988 EBW182623
EBW192990 EBW213087 EBW184055 EBW192939 EBW192418 EBW182706 EBW172714 EBW192907 EBW213073 EBW192816
King bird EBW192938 EBW192349 EBW192901 EBW224002 EBW224003 EBW193173 EBW192807 EBW192493 EBW193080
Row
EBW192361 EBW192954 EBW192924 EBW150047 EBW182463 EBW192350 EBW224001 EBW192986 EBW213092 EBW192789
EBW213106 EBW192915 Pavon−76 EBW224004 Hawi EBW194173 EBW192758 EBW213077 EBW212106 EBW150051
EBW192915 Pavon−76 EBW213106 Hawi EBW192901 EBW182463 EBW194173 EBW224001 EBW213077 EBW212106
EBW192938 EBW192361 EBW224004 EBW192990 EBW212138 EBW192758 EBW150051 EBW184055 EBW192816 EBW192493
EBW192418 EBW192940 EBW213087 EBW193097 King bird EBW192927 EBW192939 EBW192350 EBW213092 EBW150062
EBW192349 EBW193080 EBW213073 EBW194076 EBW172714 EBW192789 EBW192369 EBW224002 EBW192930 EBW192954
EBW182714 EBW192924 EBW192945 EBW192907 EBW192931 EBW193173 EBW192986 EBW182706 EBW192763 ETBW9396
EBW150047 EBW192929 EBW182623 EBW192922 EBW192807 EBW192406 EBW224003 EBW192988 Dursa EBW192793
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Spatial methods of analysis
Smooth continuous trend
I In our BWNE22AN example we have 10 columns by 18 rows. Let's
look at the residuals between columns rst (averaged over rows).
I We are going to estimate a correlation between columns, ρc , such
that the covariance between plots in dierent columns is.
1
ρc 1
ρc 2 1
ρc
ρc 3 ρc 2 1
ρc
.. ..
. .
ρc (nc −1) ··· ρc 1
Spatial methods of analysis
Smooth continuous trend
I And we are going to estimate a correlation between rows, ρr , such
that the covariance between plots in dierent rows is.
1
ρr 1
ρr 2 1
ρr
ρr 3 ρr 2 1
ρr
.. ..
. .
ρr (nr −1) ··· ρr 1
Spatial methods of analysis
The variance of the data
Decaying correlation structure across rows
0
5
scor
0.3
Plot
10 0.2
0.1
15
0 5 10 15
Spatial methods of analysis
The variance of the data
Decaying correlation structure across rows
0
0
5
50
cor scor
0.4
10 0.5
0.3
Plot
Plot
0.4
100 0.2 0.3
0.2
0.1 0.1
15
0.0
150
20
0 50 100 150 0 5 10 15 20
Plot Plot
Spatial methods of analysis
Smooth continuous trend
I Then we combine the row and column correlation matrices into a
combined variance structure for ALL residuals, as
var(ei , ej ) = σ 2 ρrdr (i,j) ρdc c (i,j)
where dr and dc are the distances between plots i and j in the row and
column direction. For example if ρc =0.3 and ρr =0.8, then
For the same plot, var(e1 , e1 ) = σ 2
For plots one row and one column apart, var(ei , ej ) = σ 2 0.3 ∗ 0.8
For plots in the same row: var(ej , ej ) = σ 2 0.3dc
For plots in the same column : var(ei , ej ) = σ 2 0.8dr
The variance structure is a separable autoregressive process of order 1
(ar1) for rows by columns.
Spatial methods of analysis
I In the approach of Gilmour et al. (1997), spatial trend can be
modelled on three scales.
I We have already looked at the model for smooth continuous trend
between neighbouring plots resulting from soil/moisture/fertility
uctuations in the eld.
I Extraneous trend, often aligned with dimensions of the eld trial,
and induced by management practices such as planting, harvesting,
plot trimming and irrigation.
I Global trend, which involves a change in mean across the spatial
dimension of the trial.
Spatial methods of analysis
Extraneous trend
I We t a random (structural) factor for Replicate, Row and Column
factors in the model, and assume an IID normal variance models for
these random eects.
Smooth trend
I We t an autoregressive process of order 1 across the Row and
Column factors at the residual plot level.
We use residual diagnostics to assess the adequacy of our model using
the plot command and the [Link]() command.
Spatial methods of analysis
I The sample variogram, is calculated as 12 (êi − êj )2
The sample variogram
A theoretical sample variogram for ρr =0.8 and ρc =0.2
1.00
0.95
vh
0.90
0.85
20
10 15
10 g)
co
lu (la
m 5 ro
w
n
(la 5
g)
0 0
Spatial methods of analysis
We t the baseline spatial model by specifying a separable ar1xar1
process for the residual, and tting random Replicate, Column and Row
terms due to the design:
[Link] <- asreml(yield~ 1,
random=~ Replicate + Genotype + Column + Row ,
residual=~ar1(Column):ar1(Row),
data=[Link])
I Then we examime the adequacy of the model t using the residual
diagnostics.
Spatial methods of analysis
First we check the residual plots
15
1.0
0.5
10
Residuals
Count
0.0
5
−0.5
−1.0
0
−1.0 −0.5 0.0 0.5 1.0 2 3 4 5 6
Residuals Fitted
1.0
1
0.5
Residuals
Sample
0 0.0
−0.5
−1
−1.0
−3 −2 −1 0 1 2 3 0 50 100 150
Theoretical Units
Spatial methods of analysis
[Link]
Then we check out the variogram
0.30
0.25
0.20
0.15
0.10
0.05
0.00
15
4
Column 10
(lag)
2
Row
0
0 (lag)
Spatial methods of analysis
I If the variogram is approximately at on top, without any systematic
trends then we accept the spatial model
I It has a log-likelihood of -26.89.
I We can compare it with the RCB analysis model using a REMLRT as
2 × (−26.89 − (−62.05)) = 70.32
with 1 df.
I This is so large compared to the critical values of a χ21 distribution
(95th percentile = 3.84) that we can safely conclude that there is
evidence of a random column eect.
##REMLRT to determine if addition of random Column term was significant
[Link] <- (2)*([Link]$logl - [Link]); [Link]
pimprov <- 1-pchisq([Link],df=1);pimprov ##significant improvement
Spatial methods of analysis
We can obtain genotype predictions from this spatial model.
## *** Predicting BLUPs for Genotype *** ##
[Link] <- predict([Link], "Genotype")
[Link]$pvals
Comparing the RCB and spatial model
Genotype BLUPs − Spatial 5.0
4.5
4.0
4.00 4.25 4.50 4.75 5.00 5.25
Genotype BLUPs − RCB
Column
1
2
3
4
5
6
7
8
9
10
EBW194173 EBW192990 EBW192901 EBW192758 EBW192986 EBW212106 EBW192988 EBW192816 EBW192793 EBW182706
Spatial trend
EBW192763 EBW182463 EBW224004 EBW213092 EBW150051 EBW192807 EBW213077 EBW224003 EBW184055 EBW192930
EBW192954 EBW213106 EBW192940 EBW192349 EBW192915 EBW192939 EBW192493 EBW224001 EBW224002 EBW193097
Hawi EBW150047 EBW192938 Pavon−76 EBW192418 EBW193080 EBW192350 EBW192369 EBW193173 EBW213073
EBW194076 King bird EBW192924 EBW213087 EBW192361 EBW192931 EBW192789 Dursa EBW192907 EBW192406
EBW192929 EBW192945 EBW212138 EBW150062 EBW182714 EBW192927 EBW192922 EBW172714 EBW182623 ETBW9396
EBW192945 EBW194076 EBW150062 EBW192930 EBW192929 EBW182714 EBW192931 EBW192922 ETBW9396 Dursa
EBW192940 EBW212138 EBW193097 EBW192793 EBW192927 EBW192369 EBW192406 EBW192763 EBW192988 EBW182623
EBW192990 EBW213087 EBW184055 EBW192939 EBW192418 EBW182706 EBW172714 EBW192907 EBW213073 EBW192816
King bird EBW192938 EBW192349 EBW192901 EBW224002 EBW224003 EBW193173 EBW192807 EBW192493 EBW193080
Row
EBW192361 EBW192954 EBW192924 EBW150047 EBW182463 EBW192350 EBW224001 EBW192986 EBW213092 EBW192789
EBW213106 EBW192915 Pavon−76 EBW224004 Hawi EBW194173 EBW192758 EBW213077 EBW212106 EBW150051
EBW192915 Pavon−76 EBW213106 Hawi EBW192901 EBW182463 EBW194173 EBW224001 EBW213077 EBW212106
EBW192938 EBW192361 EBW224004 EBW192990 EBW212138 EBW192758 EBW150051 EBW184055 EBW192816 EBW192493
EBW192418 EBW192940 EBW213087 EBW193097 King bird EBW192927 EBW192939 EBW192350 EBW213092 EBW150062
EBW192349 EBW193080 EBW213073 EBW194076 EBW172714 EBW192789 EBW192369 EBW224002 EBW192930 EBW192954
EBW182714 EBW192924 EBW192945 EBW192907 EBW192931 EBW193173 EBW192986 EBW182706 EBW192763 ETBW9396
EBW150047 EBW192929 EBW182623 EBW192922 EBW192807 EBW192406 EBW224003 EBW192988 Dursa EBW192793
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18