recalcLSD.alldiffs {asremlPlus} | R Documentation |
Adds or recalculates the LSD.frame
that is a component of an
alldiffs.object
.
Description
Given an alldiffs.object
, adds or recalculate its LSD.frame
.
N.B. No changes are made to the error.intervals — use redoErrorIntervals.alldiffs
to modify both the error.intervals and the LSD.frame
.
Usage
## S3 method for class 'alldiffs'
recalcLSD(alldiffs.obj, LSDtype = "overall", LSDsupplied = NULL,
LSDby = NULL, LSDstatistic = "mean", LSDaccuracy = "maxAbsDeviation",
alpha = 0.05, ...)
Arguments
alldiffs.obj |
An |
LSDtype |
A See |
LSDsupplied |
A |
LSDby |
A |
LSDstatistic |
A |
LSDaccuracy |
A |
alpha |
The significance level for an LSD to compare a pair of predictions.
It is stored as an attribute to the |
... |
further arguments passed to |
Value
An alldiffs.object
with components
predictions
, vcov
, differences
, p.differences
sed
, LSD
and, if present in alldiffs.obj
, backtransforms
.
Author(s)
Chris Brien
See Also
asremlPlus-package
, as.alldiffs
, sort.alldiffs
,
subset.alldiffs
, print.alldiffs
,
renewClassify.alldiffs
, exploreLSDs.alldiffs
,
pickLSDstatistics.alldiffs
,
redoErrorIntervals.alldiffs
,
plotPredictions.data.frame
,
predictPlus.asreml
,
predictPresent.asreml
Examples
data(WaterRunoff.dat)
##Use asreml to get predictions and associated statistics
## Not run:
asreml.options(keep.order = TRUE) #required for asreml-R4 only
current.asr <- asreml(fixed = pH ~ Benches + (Sources * (Type + Species)),
random = ~ Benches:MainPlots,
keep.order=TRUE, data= WaterRunoff.dat)
current.asrt <- as.asrtests(current.asr, NULL, NULL)
TS.diffs <- predictPlus(classify = "Sources:Type",
asreml.obj = current.asr,
wald.tab = current.asrt$wald.tab,
present = c("Sources", "Type", "Species"))
## End(Not run)
## Use lmeTest and emmmeans to get predictions and associated statistics
if (requireNamespace("lmerTest", quietly = TRUE) &
requireNamespace("emmeans", quietly = TRUE))
{
m1.lmer <- lmerTest::lmer(pH ~ Benches + (Sources * (Type + Species)) +
(1|Benches:MainPlots),
data=na.omit(WaterRunoff.dat))
TS.emm <- emmeans::emmeans(m1.lmer, specs = ~ Sources:Species)
TS.preds <- summary(TS.emm)
den.df <- min(TS.preds$df, na.rm = TRUE)
## Modify TS.preds to be compatible with a predictions.frame
TS.preds <- as.predictions.frame(TS.preds, predictions = "emmean",
se = "SE", interval.type = "CI",
interval.names = c("lower.CL", "upper.CL"))
## Form an all.diffs object and check its validity
TS.vcov <- vcov(TS.emm)
TS.diffs <- allDifferences(predictions = TS.preds, classify = "Sources:Species",
vcov = TS.vcov, tdf = den.df)
validAlldiffs(TS.diffs)
}
## Plot p-values for predictions obtained using asreml or lmerTest
if (exists("TS.diffs"))
{
##Recalculate the LSD values for predictions obtained using asreml or lmerTest
TS.diffs <- recalcLSD.alldiffs(TS.diffs, LSDtype = "factor.combinations",
LSDby = "Sources")
}