chooseModel.data.frame {asremlPlus} | R Documentation |
data.frame
,
taking into account the marginality relations of terms and recording the tests used
in a data.frame
.Uses the p.values
from a set of hypothesis tests that are stored in
the supplied data.frame
to choose a model to describe the effects of the
terms corresponding to the p-values, taking into account the hierarchy or 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. The tests used in choosing the selected model are listed in the
data.frame
choose.summary
.
No change is made to the p.values
, the DF
and denDF
being for
information only.
## S3 method for class 'data.frame' chooseModel(object, terms=NULL, p.values = "Pr", DF = "Df", denDF = "denDF", omit.DF = FALSE, terms.marginality=NULL, alpha = 0.05, ...)
object |
a |
terms |
A |
p.values |
A |
DF |
Can be a |
denDF |
Can be a |
omit.DF |
A |
terms.marginality |
A square matrix of ones and zeros with row and column names
being the names of the those terms in the |
alpha |
The significance level for the hypothesis testing. |
... |
Provision for passsing arguments to functions called internally - not used at present. |
A list containing:
choose.summary
: a data.frame
summarizing
the tests carried out in choosing the significant terms;
provided omit.DF =
FALSE
, it has the same columns as a
test.summary
from an asrtests.object
sig.tests
: a character vector
whose elements are the
the significant terms amongst those tested.
Chris Brien
chooseModel
, chooseModel.asrtests
data("Ladybird.dat") ## Use asreml to get the table of p-values ## Not run: m1.asr <- asreml(logitP ~ Host*Cadavers*Ladybird, random = ~ Run, data = Ladybird.dat) current.asrt <- as.asrtests(m1.asr) fixed.tab <- current.asrt$wald.tab col.p <- "Pr" df = "Df" den.df = "denDF" ## End(Not run) ## Use lmeTest to get the table of p-values if (requireNamespace("lmerTest", quietly = TRUE) & requireNamespace("emmeans", quietly = TRUE)) { m1.lmer <- lmerTest::lmer(logitP ~ Host*Cadavers*Ladybird + (1|Run), data=Ladybird.dat) fixed.tab <- anova(m1.lmer, type = "II") col.p <- "Pr(>F)" df = "NumDF" den.df = "DenDF" } ## Select a model using the table of p-values obtained with either asreml or lmerTest if (exists("fixed.tab")) { term.marg <- dae::marginality(dae::pstructure(~ Host*Cadavers*Ladybird, data = Ladybird.dat)) chosen <- chooseModel(fixed.tab, p.values = col.p, DF = df, denDF = den.df, terms.marginality = term.marg) }