LSD.frame | R Documentation |
A data.frame
that stores
Least Significant differences (LSDs) for predictions
for a fitted model.
A data.frame
that can be a component of an alldiffs.object
and that
contains LSD values and statistics to be used in determining the significance of the
pairwise differences. In particular, they are used in calculating
halfLeastSignificant
limits to be included in a predictions.frame
.
Exactly what an LSD.frame
contains is
determined by the following arguments to functions that return an
alldiffs.object
: LSDtype
, LSDby
, LSDstatistic
,
LSDaccuracy
and LSDsupplied
. The rownames
of the LSD.frame
indicate, for each of its rows, for what group of predictions the entries in the row were calculated,
this being controlled by the LSDtype
and LSDby
arguments. The values for
all of the LSD arguments are stored as attributes to the alldiffs.object
and the
predictions
and, if present backtransforms
, components of the
alldiffs.object
.
An LSD.frame
always has the eight columns c
, minimumLSD
, meanLSD
,
maximumLSD
, assignedLSD
, accuracyLSD
, falsePos
and
falseNeg
.
c
: This gives the number of pairwise comparison of predictions for the combinations of
the factor levels given by the row name. If the row name is overall
then it is for
all predictions.
minimumLSD, meanLSD, maximumLSD
: These are computed for either overall
,
factor.combinations
, per.prediction
or supplied
LSD values, as specified by the
LSDtype
argument. The meanLSD
is calculated using the square root of the mean of
the variances of set of pairwise differences appropriate to the specific LSDtype
argument.
For overall
, the mean, minimum and maximum of the LSDs for all pairwise
comparisons are computed.
If factor.combinations
was specified for
LSDtype
when the LSDs were being calculated, then the LSD.frame
contains a row for each combination of the values of the factors
and
numerics
specified by LSDby
. The values in a row are calculated
from the LSD values for the pairwise differences for each combination of the
factors
and numerics
values, unless there is only one
prediction for a combination, when notional LSDs are calculated that are based on the
standard error of the prediction multiplied by the square root of two.
For per.prediction
, the minimum, mean and maximum LSD, based, for each prediction,
on the LSD values for all pairwise differences involving that prediction are computed.
For supplied
, the LSD.frame
is set up based on the setting of LSDby
:
a single row with name overall
if LSDby
is NULL
or, if LSDby
is a vector of factor
and numeric
names, rows for each observed
combinations of the values of the named factors
and numerics
.
The LSDsupplied
argument is used to provide the values to be stored in the column
assignedLSD
.
assignedLSD
: The assignedLSD
column contains the values that are assigned for
use in calculating halfLeastSignificant
error.intervals
. Its contents are
determined by LSDstatistic
and LSDsupplied
arguments. The
LSDsupplied
argument allows the direct specification of values to be placed
in the assignedLSD
column of the LSD.frame
. The default is to use the
values in the meanLSD
column.
LSDaccuracy
: The LSDaccuracy
gives an indication of the proportion that the
correct LSD for a single predicted.value
might deviate from its assignedLSD
value.
The contents of the accuracyLSD
column is controlled by the LSDaccuracy
argument.
falsePos
and falseNeg
: These columns contain the number of false positives
and negatives if the assignedLSD
value(s) is(are) used to determine the significance
of the pairwise predictions differences. Each LSD value in the assignedLSD
column is used to determine the significance of pairwise differences that involve
predictions for the combination of values given by the row name for the LSD value.
See recalcLSD.alldiffs
for more information.
Chris Brien
recalcLSD.alldiffs
, redoErrorIntervals.alldiffs
,
predictPresent.asreml
,
predictPlus.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.diffs <- predictPlus(m1.asr, classify="Nitrogen:Variety",
wald.tab = current.asrt$wald.tab,
tables = "none")
## 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)
#Get predictions
Var.emm <- emmeans::emmeans(m1.lmer, specs = ~ Nitrogen:Variety)
Var.preds <- summary(Var.emm)
## 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
#Set up an alldiffs object, which includes overall LSDs
Var.diffs <- allDifferences(predictions = Var.preds, classify = "Variety:Nitrogen",
sed = Var.sed, vcov = Var.vcov, tdf = 45)
}
if (exists("Var.diffs"))
{
## Use recalcLSD to get LSDs for within Variety differences
Var.LSD.diffs <- recalcLSD(Var.diffs,
LSDtype = "factor.combinations", LSDby = "Variety")
print(Var.LSD.diffs$LSD)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.