spatial.single Fit the spatial model according to the specification of conditions given a provided dataset. It also calculates goodness-of-fit statisitcs to later compare with other spatial model. This routine works best for replicated genotypes. Some checks on data are incorporated, but data is assumed to come in a full grid.

spatial.single(
  data = NULL,
  gen = NULL,
  block = NULL,
  ibk = NULL,
  row = NULL,
  col = NULL,
  cov1 = NULL,
  cov2 = NULL,
  resp = NULL,
  add.block = FALSE,
  add.ibk = FALSE,
  add.row = FALSE,
  add.col = FALSE,
  add.spl.row = FALSE,
  add.spl.col = FALSE,
  add.cov1 = FALSE,
  add.cov2 = FALSE,
  add.nugget = FALSE,
  type.gen = "random",
  type.block = "fixed",
  type.residual = "ar1"
)

Arguments

data

dataframe with all relevant columns for spatial model and response variables.

gen

factor name for genotypes (or treatments)

block

factor name for full block (or replicates) (optional)

ibk

factor name for incomplete block (optional) (optional)

row

column name for row coordinates of each experimental unit

col

column name for column coordinates of each experimental unit

cov1

column name with additional covariate 1 (optional)

cov2

column name with additional covariate 2 (optional)

resp

column name for the response variable to analyze

add.block

logical to add to model block effects (default = FALSE)

add.ibk

logical to fit incomplete block random effects (default = FALSE)

add.row

logical to fit row within block random effects (default = FALSE)

add.col

logical to fit column within block random effects (default = FALSE)

add.spl.row

logical to fit splines across rows (default = FALSE)

add.spl.col

logical to fit splines across columns (default = FALSE)

add.cov1

logical to fit additional covariate 1 (default = FALSE)

add.cov2

logical to fit additional covariate 2 (default = FALSE)

add.nugget

logical to fit nugget random effects (only for autoregressive errors) (default = FALSE)

type.gen

model assumption for genotypes: 'random' or 'fixed' (default = 'random')

type.block

model assumption for full blocks: 'random' or 'fixed' (default = 'fixed')

type.residual

model assumption for residual terms: 'indep' or 'ar1' (default = 'ar1')

Value

Several objects with details of the fitted model. aov: Wald-test (mixed model ANOVA-like table) call: String with the ASReml-R call used to fit the requested model gt: Goodness-of-fit statistics for the model evaluated are reported as summary. This includes columns: number of variance components in the model (n.VC), log-likelihood (logL), Akaike information criteria (AIC), Bayesian information criteria (BIC), A-optimality value, logarithm of the D-optimality value, and heritability based on predictor error variance (heritPEV, only for genotypes 'random') mod: ASReml-R object with all information from the fitted model predictions: Predictions for all genotypes, with an additional column of 'weight' is to be used on a on a second-stage analysis. These weights are the diagonal of the inverse of the variance- covariance matrix of predictions

Author

Salvador A. Gezan. VSN International

Examples

# Example 1: Replicated Trial - Genotype random + spatial terms
# library(agridat)
# testREP <- durban.rowcol
# testREP$bed <- as.factor(testREP$bed)
# testREP$row <- as.factor(testREP$row)
# testREP$gen <- as.factor(testREP$gen)
# head(testREP)
# output.REP <- spatial.single(data=testREP, gen='gen', row='row', col='bed', resp='yield',
#                             add.block=TRUE,  add.row=TRUE,  add.col=TRUE,
#                             type.gen='random', type.block='fixed', type.residual='ar1')
# output.REP$gt$herit.PEV           # Heritability-PEV
# output.REP$aov                    # Wald Test
# summary(output.REP$mod)$varcomp   # Variance Components
# head(output.REP$predictions)
#
# # Example 2: Simpler model - independent errors
# output.ID <- spatial.single(data=testREP, gen='gen', row='row', col='bed', resp='yield',
#                             add.block=TRUE,  add.row=TRUE,  add.col=TRUE,
#                             type.gen='random', type.block='fixed', type.residual='indep')
# output.ID$gt$herit.PEV           # Heritability-PEV
# output.ID$aov                    # Wald Test
# summary(output.ID$mod)$varcomp   # Variance Components
# head(output.ID$predictions)
#
# # Example 3: Comparing Models with a LRT
# lrt.asreml(output.REP$mod, output.ID$mod, boundary=FALSE)