changeModelOnIC.asrtests {asremlPlus}  R Documentation 
Uses information criteria to decide whether to change an already fitted model.
Description
Uses information criteria to decide whether to change the fitted model
stored in the supplied asrtests.object
according to the specified
modifications. The function changeTerms
is
used to change the model. Thus, the model can be modified using a
combination of adding and removing sets of terms from one or both of the fixed
or random models and replacing the residual model.
A row is added to the test.summary
data.frame
of the
asrtests.object
using the supplied label
and stating
whether or not the new model has been swpped for the supplied model.
Convergence in fitting the model is checked and a note included in the
action
if there was not. All components of the
asrtests.object
are updated to exhibit the differences
between the suupplied and new model.
To obtain a list of the information criteria for a set of models use
changeTerms.asrtests
with IClikelihood
set to
REML
or full
, or use infoCriteria.asreml
.
Usage
## S3 method for class 'asrtests'
changeModelOnIC(asrtests.obj,
dropFixed = NULL, addFixed = NULL,
dropRandom = NULL, addRandom = NULL,
newResidual = NULL, label = "Changed terms",
allow.unconverged = TRUE, checkboundaryonly = FALSE,
trace = FALSE, update = TRUE, denDF = "numeric",
set.terms = NULL, ignore.suffices = TRUE,
bounds = "P", initial.values = NA,
which.IC = "AIC", IClikelihood = "REML",
fixedDF = NULL, varDF = NULL,
bound.exclusions = c("F","B","S","C"),
...)
Arguments
asrtests.obj 
An asrtests.object containing the components
(i) asreml.obj ,(ii) wald.tab , and (iii) test.summary .

dropFixed 
A single character string in the form of a formula which,
after addition of ". ~ . " and after expansion, specifies the sum
of a set of terms to be dropped from the fixed formula.
The names must match those in the wald.tab component of the
asrtests.object .

addFixed 
A single character string in the form of a formula which,
after addition of ". ~ . +" and expansion, specifies the sum
of a set of terms to be added to the fixed formula.

dropRandom 
A single character string in the form of a formula which,
after addition of " ~ . " and expansion, specifies the sum
of a set of terms to be dropped from the random formula.
The names must match those in the vparameters component of the
asreml.obj component in the asrtests.object .

addRandom 
A single character string in the form of a formula which,
after addition of " ~ . +" and expansion, specifies the sum
of a set of terms to be added to the random formula.

newResidual 
A single character string in the form of a formula which,
after addition of " ~ " , specifies the residual
(or rcov ) model. To remove the model, enter "(.)" .

label 
A character to use as an entry in the terms column in
test.summary to indicate as far as is possible the terms that are
being manipulated.

allow.unconverged 
A logical indicating whether to accept a new model
even when it does not converge. If FALSE and the fit of the new
model does not converge, the supplied asreml object is returned.
Also, if FALSE and the fit of the new model has converged, but that
of the old model has not, the new model will be accepted.

checkboundaryonly 
If TRUE then boundary and singular terms are not removed by
rmboundary.asrtests ; a warning is issued instead.

trace 
If TRUE then partial iteration details are displayed when ASRemlR
functions are invoked; if FALSE then no output is displayed.

update 
If TRUE then update.asreml is called to fit the model
to be tested. In doing this the arguments R.param and
G.param are set to those in the asreml
object stored in asrtests.obj so that the values from the previous
model are used as starting values. If FALSE then a call is made to
asreml in which the only changes from the previous call are that
(i) models are modifed as specified and
(ii) modifications specified via ... are made.

denDF 
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 autommatically 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.

set.terms 
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 asrtests.object .

ignore.suffices 
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 .

bounds 
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.

which.IC 
A character specifying the information criterion to be used in
selecting the best model. Possible values are AIC and
BIC . The values of the criterion for supplied model must
exceed that for changed model for the changed model to be returned.

IClikelihood 
A character specifying whether Restricted Maximum Likelihood
(REML ) or the full likelihood (full ) are to be used in
calculating the information criteria.

fixedDF 
A numeric giving the number of estimated fixed parameters. If
NULL then this is determined from the information in
asreml.obj .

varDF 
A numeric giving the number of estimated variance parameters. If
NULL then this is determined from the information in
asreml.obj . It replaces the varDF argument.

initial.values 
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.

bound.exclusions 
A character specifying the bound (constraint) codes that
will result in a variance parameter being excluded from the count of
estimated variance parameters in calculating the information criteria.
If set to NULL then none will be excluded.

... 
Further arguments passed to asreml , wald.asreml and
as.asrtests .

Value
An asrtests.object
containing the components (i) asreml.obj
,
(ii) wald.tab
, and (iii) test.summary
. The values of the degrees of
freedom and the information criteria are differences between those of the changed
model and those of the model supplied to changeModelOnIC
.
Author(s)
Chris Brien
See Also
as.asrtests
, rmboundary.asrtests
,
testranfix.asrtests
, testresidual.asrtests
,
newfit.asreml
, reparamSigDevn.asrtests
,
chooseModel.asrtests
, changeTerms.asrtests
,
infoCriteria.asreml
Examples
## Not run:
data(Wheat.dat)
current.asr < asreml(yield ~ Rep + WithinColPairs + Variety,
random = ~ Row + Column + units,
residual = ~ ar1(Row):ar1(Column),
data=Wheat.dat)
current.asrt < as.asrtests(current.asr, NULL, NULL,
label = "Maximal model")
current.asrt < rmboundary(current.asrt)
# Drop both Row and Column terms
current.asrt < changeModelOnIC(current.asrt,
dropRandom = "Row + Column",
checkboundaryonly = TRUE,
which.IC = "AIC", IClikelihood = "full")
current.asrt < iterate(current.asrt)
# Add and drop both fixed and random terms
current.asrt < changeModelOnIC(current.asrt,
addFixed = "vRow", dropFixed = "WithinColPairs",
addRandom = "spl(vRow)", dropRandom = "units",
checkboundaryonly = TRUE,
which.IC = "AIC", IClikelihood = "full")
# Replace residual with model without Row autocorrelation
current.asrt < changeModelOnIC(current.asrt,
newResidual = "Row:ar1(Column)",
label="Row autocorrelation",
IClikelihood = "full")
## End(Not run)
[Package
asremlPlus version 4.232
Index]