asreml by removing oldterms
and adding newterms. If simpler = FALSE the model to be fitted
must be more complex than the one whose fit has been stored in
asrtests.obj. That is, the new model must have more parameters.
However, if simpler = TRUE the model to be fitted must be simpler
than the one whose fit has been stored in asrtests.obj in that it
must have fewer parameters. The test is a REML ratio test that is performed using
reml.lrt.asreml, which is only valid if the models are nested.
It compares the newly fitted model with the fit of the model in
asrtest.obj. A row is added to the test.summary
data.frame using the supplied label. If the newly fitted model
is retained, any boundary terms are then removed using
rmboundary.asrtests.testswapran.asrtests(oldterms = NULL, newterms = NULL, asrtests.obj,
label = "Swap in random model", simpler = FALSE,
alpha = 0.05, positive.zero = FALSE, denDF="default",
trace = FALSE, update = TRUE,
set.terms = NULL, ignore.suffices = TRUE,
constraints = "P", initial.values = NA, ...)character, that are to be removed from the
random model using asreml.character, that are to be added to the
random model using asreml.asrtests object for a fitted model that is a list
containing an asreml object, a wald.tab
data.frame with 4 columns, and a oldterms for
newterms, is simpler than the already fitted model whose
fitest.summary and
which indicates what is being tested.wald.asreml is called. Can be none
to suppress the computations, numeric for numerical methods,TRUEthen update.asreml is called to change
the model. In doing this the arguments R.param and
G.param are set to those in the asreml object
asreml-assigned names of the variance terms (i.e. the
information to the right of an "!", other than "R!") is to
be ignoterms. This vector
must be of length one or the same length as terms.
If it iterms. This vector
must be of length one or the same length as terms.
If it is of lengasreml and wald.asreml.asrtests object, which is a list containing:
asreml.obj: anasremlobject containing the fit
after thetermhas been omitted from the model;wald.tab: a 4-columndata.framecontaining a
pseudo-anova table for the fixed terms produced bywald.asreml;test.summary: adata.framewith columnsterm,DF,denDF,pandaction. A row is added to
it for each term
that is dropped, added or tested or a note that several terms have been
added or removed. A row contains the name of the term, the
DF, the p-value and the action taken. Possible codes are:Dropped,Retained,Swapped,Unswapped,Significant,Nonsignificant,Absent,Added,RemovedandBoundary. If the changed model did not
converge,Unconvergedwill be added to the code.
Note that the logicalasreml.obj$convergealso
reflects whether there is convergence.term is not in the model, then the supplied asreml
object will be returned. Also, reml.test will have the likelihood
ratio and the p-value set to NA and the degrees of freedom to zero.
Similarly, the row of test.summary for the term will have
its name, a p-value set to NA, and action set to Absent.asrtests, choose.model.asrtests,
reml.lrt.asreml, rmboundary.asrtests,
newfit.asreml, testrcov.asrtests,
addrm.terms.asrtests, sig.devn.reparam.asrtestscurrent.asrt <- testswapran.asrtests(oldterms = "str(~ Cart/xDays, ~us(2):id(184))",
newterms = "Cart/xDays",
current.asrt, pos = FALSE,
label = "Intercept/Slope correlation",
simpler = TRUE)
print(current.asrt)Run the code above in your browser using DataLab