R/asreml_funct.R
spatial.aud.Rd
spatial.aud
Generates a table with the goodness-of-fit statisitcs to select the
best spatial model for an analysis of an Augmented, Unreplicated or a P-Rep design.
The models fitted are: 1) independent errors, 2) spatial (ar1) in columns, 3) spatial (ar1)
in rows, and 4) spatial (ar1) in both rows and columns. If blocks are provided, these will
be fitted as random effects. Genotype (or treatment) effects can be specified as random or fixed.
If an additional factor of checks is provided then these will be fitted as fixed effects.
spatial.aud(
data = NULL,
gen = NULL,
check = NULL,
block = NULL,
row = NULL,
col = NULL,
covariate = NULL,
nugget = FALSE,
resp = NULL,
type.gen = "random",
model = NULL
)
dataframe with all relevant columns for spatial model and response variables.
factor name for genotypes (or treatments)
factor name for checks (labeled 'control') and test lines (labeled 'test') (optional)
factor name for block (or replicates) (optional)
factor name for row coordinates of each experimental unit
factor name for column coordinates of each experimental unit
factor for additional covariate (optional)
logical to fit nugget random effects (default = FALSE)
column name for the response variable to analyze
model assumption for genotypes: 'random' or 'fixed' (default = 'random')
model number to be fitted (optional)
A table with goodness-of-fit statistics for models evaluated. This includes columns: number of variance components in the model (n.VC), log-likelihood (logL), Akaike information criteria (AIC), Bayesian information criteria (BIC), heritability based on predictor error variance (heritPEV, only for genotypes 'random'), A-optimality value, logarithm of D-optimality value, and pvalue of comparison of each model against Independent Model based on a likelihood ratio test (LRT). If parameter model is specified an object with fitted model number is provided, together with predictions for genotypes, here an additional column of 'weight' is incorporated to be used on a second-stage analysis. These weights are the diagonal of the inverse of the variance- covariance matrix of predictions.
# Example 1: Analysis Unreplicated Trial
# library(agridat)
# UR <- burgueno.unreplicated
# UR$col <- as.factor(UR$col)
# UR$row <- as.factor(UR$row)
# UR$gen <- as.factor(UR$gen)
# head(UR)
# output.UR <- spatial.aud(data=UR, gen='gen', row='row', col='col', resp='yield',
# type.gen='random')
# output.UR
#
# # Example 2: Fitting only Model 4: ar1(Row):ar1(Col)
# mod4.UR <- spatial.aud(data=UR, gen='gen', row='row', col='col', resp='yield',
# type.gen='random', model=4)
# summary(mod4.UR$mod)$varcomp # Summary from ASReml-R
# head(mod4.UR$predictions) # Predictions