asrtests.object,
taking into account the hierarchy or marginality relations of the terms.Performs a series of hypothesis tests on a set of fixed and/or random terms taking
into account the marginality of terms. In particular, a term will not be tested if it is
marginal to (or nested in) one that is significant. For example, if A:B is significant, then
neither A nor B will be tested. For a random term, the term is removed from
the model fit, any boundary terms are removed using rmboundary.asrtests
and a REML likelihood ratio test is performed using REMLRT.asreml.
If it is not significant and drop.ran.ns is TRUE, the term is permanently removed
from the model. Note that if boundary terms are removed, the reduced model may not
be nested in the full model in which case the test is not valid. For fixed terms,
the Wald tests are performed and the p-value for the term obtained. If it is not
significant and drop.fix.ns is TRUE, the term is permanently removed
from the model. A row that records the outcome of a test is added to
test.summary for each term that is tested.
# S3 method for asrtests
chooseModel(object, terms.marginality=NULL,
alpha = 0.05, allow.unconverged = TRUE,
allow.fixedcorrelation = TRUE,
checkboundaryonly = FALSE, drop.ran.ns=TRUE,
positive.zero = FALSE, bound.test.parameters = "none",
drop.fix.ns=FALSE, denDF = "numeric", dDF.fault = "none",
dDF.values = NULL, trace = FALSE, update = TRUE,
set.terms = NULL, ignore.suffices = TRUE,
bounds = "P", initial.values = NA,
IClikelihood = "none", ...)A list containing:
asrtests.obj: an asrtests.object containing the
components (i) asreml.obj, (ii) wald.tab, and
(iii) test.summary.;
sig.tests: a character vector whose elements are the
significant terms amongst those tested.
an asrtests.object containing the components (i) asreml.obj,
(ii) wald.tab, and (iii) test.summary.
A square matrix of ones and zeros with row and column names
being the names of the terms to be tested.
The names of fixed terms must match those in the wald.tab component of the
object, while the names of random terms must match those
in the vparameters component of the
asreml.obj component in the object.
The diagonal elements of the matrix should be one, indicating
that a term is marginal to itself. Elements should be one if the row
term is marginal to the column term. All other elements should be zero.
The significance level for the test.
A logical indicating whether to accept a new model
even when it does not converge. If FALSE and a fit when
a term is removed does not converge, the term will not be removed.
A logical indicating whether to accept a new model
even when it contains correlations in the model whose values have been
designated as fixed, bound or singular. If FALSE and the new model
contains correlations whose values have not been able to be estimated,
the supplied asrtests.obj is returned. The fit in the
asreml.obj component of the supplied asrtests.obj will
also be tested and a warning issued if both fixed correlations are found
in it and allow.fixedcorrelation is FALSE.
If TRUE then boundary and singular terms are not removed by
rmboundary.asrtests; a warning is issued instead.
A logical indicating whether to drop nonsignificant random terms from the model.
Indicates whether the hypothesized values for the
variance components being tested are on the boundary
of the parameter space. For example, this is true
for positively-constrained variance components that,
under the reduced model, are zero. This argument does
not need to be set if bound.test.parameters is set.
Indicates whether for the variance components
being tested, at least some of the hypothesized values
are on the boundary of the parameter space.
The possibilities are "none", "onlybound"
and "one-and-one". The default is "none",
although if it is set to "none" and
positive.zero is TRUE then
bound.test.parameters is taken to be "onlybound".
When bound.test.parameters is set to
"one-and-one", it signifies that there are two
parameters being tested, one of which is bound and the
other is not. For example, the latter is true for testing
a covariance and a positively-constrained variance component
that, under the reduced model, are zero.
A logical indicating whether to drop a fixed term from the model when it is nonsignificant
Specifies the method to use in computing approximate denominator
degrees of freedom when wald.asreml is called. Can be none
to suppress the computations, numeric for numerical methods,
algebraic for algebraic methods or default, the default,
to automatically choose numeric or algebraic computations depending
on problem size. The denominator degrees of freedom are calculated
according to Kenward and Roger (1997) for fixed terms in the dense
part of the model.
A character specifying the method to use to obtain substitute
denominator degrees of freedom. when the numeric or algebraic methods produce
faulty values, viz. NA, Inf or less than 0.01. Consistent with
when no denDF are available, the default is "residual" and so the
residual degrees of freedom from asreml.obj$nedf are used.
If dDF.fault = "none", no substitute denominator degrees of freedom are
employed; if dDF.fault = "residual"; if dDF.fault = "maximum",
the maximum of those denDF that are available, excluding that for the
Intercept, is used; if all denDF are faulty, asreml.obj$nedf is used.
If dDF.fault = "supplied", a vector of values for the denominator
degrees of freedom is to be supplied in dDF.values. Any other setting
is ignored and a warning message produced. Generally, substituting these
degrees of freedom is anticonservative in that it is likely that the degrees
of freedom used will be too large.
A vector of values to be used when dDF.fault = "supplied".
Its values will be used when denDF in a test for a fixed effect
is NA. This vector must be the same length as the number of
fixed terms, including (Intercept) whose value could be NA.
If TRUE then partial iteration details are displayed when ASReml-R functions are invoked; if FALSE then no output is displayed.
If TRUE, and set.terms is NULL, then
newfit.asreml is called to fit the model to be tested,
using the values of the variance parameters stored in
the asreml.object, that is stored in asrtests.obj, as starting values.
If FALSE or set.terms is not NULL, then
newfit.asreml will not use the stored variance parameter
values as starting values when fitting the new model, the only
modifications being (i) to the terms in the fixed and random models
corresponding to terms in terms.marginality and
(ii) those specified via ....
A character vector specifying the terms that are to have
bounds and/or initial values set prior to fitting.
The names must match those in the vparameters component of the
asreml.obj component in the new asrtests.object.
A logical vector specifying whether the suffices of the
asreml-assigned names of the variance terms (i.e. the
information to the right of an "!", other than "R!") is to
be ignored in matching elements of terms.
If TRUE for an element of terms, the suffices
are stripped from the asreml-assigned names.
If FALSE for an element of terms, the element
must exactly match an asreml-assigned name for a
variance term. This vector must be of length one or the
same length as terms. If it is of length one then
the same action is applied to the asreml-assigned
suffices for all the terms in terms.
A character vector specifying the bounds to be applied
to the terms specified in set.terms. This vector
must be of length one or the same length as set.terms.
If it is of length one then the same constraint is
applied to all the terms in set.terms.
If any of the bounds are equal to NA then they are
left unchanged for those terms.
A character vector specifying the initial values for
the terms specified in terms. This vector
must be of length one or the same length as terms.
If it is of length one then the same initial value is
applied to all the terms in terms.
If any of the initial.values are equal to NA then they are
left unchanged for those terms.
A character that controls both the occurrence and the type
of likelihood for information criterion in the test.summary
of the new asrtests.object. If none, none are
included. Otherwise, if REML, then the AIC and BIC based
on the Restricted Maximum Likelihood are included; if full,
then the AIC and BIC based on the full likelihood, evaluated using
REML estimates, are included.
(See also infoCriteria.asreml.)
further arguments passed to asreml, wald.asreml and
as.asrtests via testranfix.asrtests.
Chris Brien
Kenward, M. G., & Roger, J. H. (1997). Small sample inference for fixed effects from restricted maximum likelihood. Biometrics, 53, 983-997.
chooseModel, chooseModel.data.frame,
as.asrtests, testranfix.asrtests,
testresidual.asrtests, REMLRT.asreml,
rmboundary.asrtests, newfit.asreml,
changeModelOnIC.asrtests, changeTerms.asrtests,
reparamSigDevn.asrtests
if (FALSE) {
data(WaterRunoff.dat)
asreml.options(keep.order = TRUE) #required for asreml-R4 only
current.asr <- asreml(log.Turbidity ~ Benches + (Sources * (Type + Species)) * Date,
random = ~Benches:MainPlots:SubPlots:spl(xDay),
data = WaterRunoff.dat, keep.order = TRUE)
current.asrt <- as.asrtests(current.asr, NULL, NULL)
terms.treat <- c("Sources", "Type", "Species",
"Sources:Type", "Sources:Species")
terms <- sapply(terms.treat,
FUN=function(term){paste("Date:",term,sep="")},
simplify=TRUE)
terms <- c("Date", terms)
terms <- unname(terms)
marginality <- matrix(c(1,0,0,0,0,0, 1,1,0,0,0,0, 1,0,1,0,0,0,
1,0,1,1,0,0, 1,1,1,0,1,0, 1,1,1,1,1,1), nrow=6)
rownames(marginality) <- terms
colnames(marginality) <- terms
choose <- chooseModel(current.asrt, marginality)
current.asrt <- choose$asrtests.obj
sig.terms <- choose$sig.terms
}Run the code above in your browser using DataLab