data("Ladybird.dat")
## Use asreml to get the table of p-values
if (FALSE) {
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"
}
## 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)
}
Run the code above in your browser using DataLab