Learn R Programming

asremlPlus (version 4.3.45)

makeTPSPlineXZMats.data.frame: Make the objects needed to fit Tensor Product P-splines.

Description

Prepares the objects needed for fitting of Tensor Product P-splines (TPPS) as described by Rodriguez-Alvarez et al. (2018). It must be run prior to fitting TPPS models for local spatial variation using addSpatialModelOnIC.asrtests and chooseSpatialModelOnIC.asrtests. The function tpsmmb from the R package TPSbits authored by Sue Welham (2022) is used to form the objects.

Usage

# S3 method for data.frame
makeTPSPlineXZMats(data, sections = NULL, 
                  row.covar, col.covar, 
                  nsegs = NULL, nestorder = c(1,1), 
                  degree = c(3,3), difforder = c(2,2),
                  asreml.option = "mbf", ...)

Value

A list of length 8 as described for TPSbits::tpsmmb, but with the last component, named data.plus, being the input data.frame to which has been added the columns required to fit the TPPS model (the data.frame stored in the data component holds only the covariates from data).

Arguments

data

An data.frame that holds the data from which the TPPS objects are to be formed.

sections

A single character string that species the name of the column in the data.frame that contains the factor that identifies different sections of the data to which separate spatial models are to be fitted.

row.covar

A single character string nominating a numeric column in the data.frame that contains the values of a covariate indexing the rows of the grid.

col.covar

A single character string nominating a numeric column in the data.frame that contains the values of a covariate indexing the columns of the grid.

nsegs

A pair of numeric values giving the number of segments into which the column and row ranges are to be split, respectively (each value specifies the number of internal knots + 1). If only one number is specified, that value is used in both dimensions. If not specified, then (number of unique values - 1) is used in each dimension; for a grid layout with equal spacing, this gives a knot at each data value.

nestorder

A character of length 2. The order of nesting for column and row dimensions, respectively; default=1 (no nesting). A value of 2 generates a spline with half the number of segments in that dimension, etc. The number of segments in each direction must be a multiple of the order of nesting.

degree

A character of length 2. The degree of polynomial spline to be used for column and row dimensions respectively; default=3.

difforder

A character of length 2. The order of differencing for column and row dimensions, respectively; default=2.

asreml.option

A single character string specifying that the mbf method is to be used to supply externally formed covariate matrices to asreml.

...

Further arguments passed to tpsmmb from package TPSbits.

Author

Chris Brien

Details

The data for experiment can be divided sections and the same spatial model fitted separately to each. The fit over all of the sections is assessed.

Each combination of a row.covar and a col.covar does not have to specify a single observation; for example, to fit a local spatial variation model to the main units of a split-unit design, each combination would correspond to a main unit and all subunits of the main unit would would have the same combination.

References

Rodriguez-Alvarez, M. X., Boer, M. P., van Eeuwijk, F. A., & Eilers, P. H. C. (2018). Correcting for spatial heterogeneity in plant breeding experiments with P-splines. Spatial Statistics, 23, 52-71.

Welham, S. J. (2022) TPSbits: Creates Structures to Enable Fitting and Examination of 2D Tensor-Product Splines using ASReml-R. Version 1.0.0 https://mmade.org/tpsbits/

See Also

addSpatialModelOnIC.asrtests, chooseSpatialModelOnIC.asrtests, tpsmmb

Examples

Run this code
if (FALSE) {

data(Wheat.dat)

#Add row and column covariates
Wheat.dat <- within(Wheat.dat, 
                    {
                      cColumn <- dae::as.numfac(Column)
                      cColumn <- cColumn  - mean(unique(cColumn))
                      cRow <- dae::as.numfac(Row)
                      cRow <- cRow - mean(unique(cRow))
                    })

#Set up the matrices
tps.XZmat <- makeTPSPlineXZMats(wheat.dat, 
                                row.covar = "cRow", col.covar = "cColumn")
}

Run the code above in your browser using DataLab