as.alldiffs | R Documentation |
alldiffs.object
from the supplied predictions, along with those statistics,
associated with the predictions and their pairwise differences, that have been supplied.Creates an alldiffs.object
that consists of a list
containing the following components: predictions
, vcov
, differences
,
p.differences
, sed
, LSD
and backtransforms
.
Predictions must be supplied to the function while the others will be set
only if they are supplied; those not supplied are set to NULL
.
It also has attributes response
, response.title
, term
,
classify
, tdf
, tdf
, alpha
, sortFactor
and sortOrder
.
which will be set to the values supplied or NULL
if none are supplied.
as.alldiffs(predictions, vcov = NULL, differences = NULL,
p.differences = NULL, sed = NULL, LSD = NULL,
backtransforms = NULL,
response = NULL, response.title = NULL,
term = NULL, classify = NULL,
tdf = NULL, alpha = 0.05,
sortFactor = NULL, sortOrder = NULL)
predictions |
A |
differences |
A |
p.differences |
A |
sed |
A |
vcov |
A |
LSD |
An |
backtransforms |
A |
response |
A |
response.title |
A |
term |
A |
classify |
A character string giving the variables that define the margins
of the multiway table used in the prediction. Multiway tables are
specified by forming an interaction type term from the
classifying variables, that is, separating the variable names
with the |
tdf |
an |
alpha |
A |
sortFactor |
A |
sortOrder |
A The following creates a |
An S3-class alldiffs.object
. Also, see predictPlus.asreml
for
more information.
Chris Brien
asremlPlus-package
, alldiffs.object
, is.alldiffs
, as.alldiffs
,
print.alldiffs
,
sort.alldiffs
, subset.alldiffs
, allDifferences.data.frame
,
renewClassify.alldiffs
, redoErrorIntervals.alldiffs
, recalcLSD.alldiffs
,
predictPlus.asreml
, plotPredictions.data.frame
, predictPresent.asreml
data(Oats.dat)
## Use asreml to get predictions and associated statistics
## Not run:
m1.asr <- asreml(Yield ~ Nitrogen*Variety,
random=~Blocks/Wplots,
data=Oats.dat)
current.asrt <- as.asrtests(m1.asr)
Var.pred <- asreml::predict.asreml(m1.asr, classify="Nitrogen:Variety",
sed=TRUE)
if (getASRemlVersionLoaded(nchar = 1) == "3")
Var.pred <- Var.pred$predictions
Var.preds <- Var.pred$pvals
Var.sed <- Var.pred$sed
Var.vcov <- NULL
## End(Not run)
## Use lmerTest and emmmeans to get predictions and associated statistics
if (requireNamespace("lmerTest", quietly = TRUE) &
requireNamespace("emmeans", quietly = TRUE))
{
m1.lmer <- lmerTest::lmer(Yield ~ Nitrogen*Variety + (1|Blocks/Wplots),
data=Oats.dat)
Var.emm <- emmeans::emmeans(m1.lmer, specs = ~ Nitrogen:Variety)
Var.preds <- summary(Var.emm)
den.df <- min(Var.preds$df)
## Modify Var.preds to be compatible with a predictions.frame
Var.preds <- as.predictions.frame(Var.preds, predictions = "emmean",
se = "SE", interval.type = "CI",
interval.names = c("lower.CL", "upper.CL"))
Var.vcov <- vcov(Var.emm)
Var.sed <- NULL
}
## Use the predictions obtained with either asreml or lmerTest
if (exists("Var.preds"))
{
## Form an all.diffs object
Var.diffs <- as.alldiffs(predictions = Var.preds, classify = "Nitrogen:Variety",
sed = Var.sed, vcov = Var.vcov, tdf = den.df)
## Check the class and validity of the alldiffs object
is.alldiffs(Var.diffs)
validAlldiffs(Var.diffs)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.