Analyses a field trial using nearest neighbour analysis (D.B. Baird).

### Options

`PRINT` = string tokens |
Controls printed output (`model` , `wald` , `components` , means, `effects` , `sed` ); default `mode` , `wald` , `comp` , `mean` , `effe` , `sed` |
---|---|

`NDIFFERENCES` = scalar |
Specifies the number of neighbours to use in differencing the plots, either 1 for first or 2 for second differences; default 1 |

`TMETHOD` = string token |
Indicates how the treatments effects are to be included in the model (`fixed` , `random` ); default `fixe` |

`UMETHOD` = string token |
Whether to include a unit-error term in the model (`include` , `omit` ); default `incl` |

`SEDMETHOD` = string token |
Specifies how the estimates of standard errors of differences of treatment effects are to be calculated (`REML` , `simulation` ); default `REML` |

`NTIMES` = scalar |
Specifies the number of simulations to make; default 100 |

### Parameters

`Y` = variates |
Variates to be analysed |
---|---|

`TREATMENTS` = factors |
Treatment factor for each y-variate |

`BLOCKS` = factors |
Block factor for each y-variate, defining groups of plots to be detrended independently |

`UNITS` = factors |
Unit-within-block factor for each y-variate, defining the order of plots within each block |

`MEANS` = tables |
Saves the estimated treatment means from each analysis |

`EFFECTS` = tables |
Saves the estimated treatment effects from each analysis |

`SED` = matrices or symmetric matrices |
Saves the estimated standard errors of differences between treatments |

`COMPONENTS` = variates |
Saves the estimated variance components from the fitted model |

`SEED` = scalars |
Seed for the random number generator used in the simulations to calculate standard error of differences; default 0 continues from the previous generation or (if none) initializes the seed automatically |

### Description

`VNEARESTNEIGHBOUR`

analyses a field trial, whose plots are arranged linearly in blocks, using a one-dimensional nearest neighbour analysis, similar to that of Stroup & Mulitze (1991). However, to avoid bias, `VNEARESTNEIGHBOUR`

estimates the variance parameters by residual maximum likelihood (REML) rather than ordinary maximum likelihood. The original method of nearest-neighbour analysis, due to Papadakis (Papadakis 1937, Bartlett 1938), can be approximated by setting `NDIFFERENCES=1`

and `UMETHOD=omit`

. However, this is an improvement on the Papadakis method, as the treatments effects and the trend are estimated jointly, instead of estimating the spatial effects from the unadjusted treatment effects (i.e. ignoring any trend).

The `NDIFFERENCES`

option controls the differencing used to detrend the data: 1 for first difference, (*y _{i}* –

*y*–

_{i}_{1}); or 2 for second differences (2

*y*–

_{i}*y*–

_{i}_{1}– y

_{i+1}), which give a stronger form of detrending. The first difference model with fixed treatment effects is equivalent to the extended first difference model of Besag & Kempton (1986) fitted by

`LVARMODEL`

.The model allows for local trends within a row, that the analysis attempts to remove by using a form of smoothing. In the full nearest neighbour model (`UMETHOD`

=`include`

), the degree of smoothing is estimated from the data. Alternatively the reduced model (`UMETHOD`

=`omit`

) applies a full detrending to the data.

The method for fitting the treatment effects is controlled by the `TMETHOD`

option. The `random`

setting treats them as random effects so that best linear unbiased predictors (*BLUP*s) are formed. The `fixed`

setting treats them as fixed effects, thus forming best linear unbiased estimates (*BLUE*s).

The nearest neighbour model treats the data as the sum of up to three components: the treatment effects, a trend component, and a unit-error (i.e. measurement error) term. The unit-error term is included by default, but you can set option `UMETHOD=omit`

to exclude it.

The variable to be analysed is specified by the `Y`

parameter, and the factor defining the treatment on each plot is specified by the `TREATMENTS`

parameter. The `BLOCKS`

parameter specifies the block factor, which defines the groups of plots that are to be detrended separately. The blocks need not all be the same length. The `UNITS`

parameter specifies the units-within-blocks factor, which defines the order of the plots within each block. For example, if the plots are on a rectangular grid and trends are to be removed along rows, the `BLOCKS`

and `UNITS`

factors would be the row and column factors, respectively. If `BLOCKS`

and `UNITS`

are not set, the plots are assumed to be in a single line (and specified sequentially down the line). The procedure can handle missing values in the y-variate but not in the `TREATMENTS`

, `BLOCKS`

or `UNITS`

factors.

The other parameters allow information to be saved from the analysis: `MEANS`

for the table of estimated treatment means; `EFFECTS`

for the table of estimated treatment effects; `SED`

for the standard errors of differences between treatments effects (in either a matrix or a symmetric matrix); and `COMPONENTS`

for the estimated variance parameters. The first variance component is the treatment variance (if `TMETHOD`

=random), the next component is the variance of the plot errors (if `UMETHOD`

=`include`

), and the final component is trend variance component.

Printed output is controlled by the `PRINT`

option with the following settings:

`model` |
prints the fitted model, |
---|---|

`wald` |
prints Wald tests of fixed effects, |

`components` |
prints the estimated variance components, |

`means` |
prints the estimated treatment means, |

`effects` |
prints the estimated treatment effects, and |

`sed` |
prints the standard errors of differences of effects. |

The option `SEDMETHOD`

controls the estimator used for the standard error of differences between treatment means or effects. The `REML`

setting uses the normal REML estimator. The `simulation`

setting uses an estimator based on simulation; this randomly samples plot and trend components from a Normal model using the estimated variance components. The `SEED`

parameter specifies the seed for the random number generator used in the simulations. The default of zero continues from the previous generation or (if none) initializes the seed automatically. The `NTIMES`

option specifies the number of simulations to make; default 100.

Options: `PRINT`

, `NDIFFERENCES`

, `TMETHOD`

, `UMETHOD`

, `SEDMETHOD`

. `NTIMES`

.

Parameters: `Y`

, `TREATMENTS`

, `BLOCKS`

, `UNITS`

, `MEANS`

, `EFFECTS`

, `SED`

, `COMPONENTS`

, `SEED`

.

### Method

A difference matrix is constructed and applied to both the treatment design matrix and `Y`

variate. The model is set up with the `VCOMPONENTS`

directive then estimated by `REML`

.

### Action with `RESTRICT`

The procedure ignores any restrictions, for example, on `Y`

, `TREATMENTS`

, `BLOCKS`

and `UNITS`

.

### References

Bartlett, M. (1938). The approximate recovery of information from replicated field experiments with large blocks. *The Journal of Agricultural Science*, **28**, 418-427.

Besag, J.E. & Kempton, R.A. (1986). Statistical analysis of field experiments using neighbouring plots. *Biometrics*, **42**, 231-251.

Papadakis, J.S. (1937). Méthode statistique pour des expériences sur champ. *Bull. Inst. Amel. Plantes a Salonique*, **23**, 13-29.

Stroup, W.W. & Mulitze, D.K. (1991). Nearest neighbor adjusted best linear unbiased prediction. *The American Statistician*, **45**, 194-200.

### See also

Directives: `REML`

, `VSTRUCTURE`

.

Procedure: `LVARMODEL`

.

Commands for: REML analysis of linear mixed models.

### Example

CAPTION 'VNEARESTNEIGHBOUR example',!t(\ 'The data (Jenkyn et al. 1979, Annals of Applied Biology, pp.',\ '11-28) are a series of Barley yields from a row of 38 plots',\ 'which had four fungicide spray treatments applied',\ '(0 = None, 1 = One spray, 2 = Two sprays, R = Repeated sprays).');\ STYLE=meta,plain VARIATE [NVALUES=38] Yield; VALUES=\ !( 5.77,5.73,6.08,5.26,5.89,5.37,5.95,5.95,5.59,5.16,5.89,6.14,6.01,\ 5.63,5.39,5.46,5.05,5.76,5.23,6.20,6.26,6.48,5.79,6.45,6.44,6.31,\ 6.18,6.43,5.82,6.47,5.73,6.54,5.99,5.76,5.04,4.38,5.06,5.13 ) FACTOR [Labels=!T('0','1','2','R');NVALUES=38] Treat; VALUES=\ !( 4, 3, 4, 1, 2, 1, 3, 4, 2, 1, 2, 3, 4,\ 3, 2, 4, 1, 4, 1, 3, 2, 3, 1, 2, 4, 2,\ 4, 3, 1, 3, 1, 4, 2, 3, 2, 1, 4, 3 ) " Fit the nearest neighbour first difference model." VNEARESTNEIGHBOUR [NDIFFERENCES=1] Yield; TREATMENTS=Treat " Fit the nearest neighbour second difference model." VNEARESTNEIGHBOUR [NDIFFERENCES=2] Yield; TREATMENTS=Treat