| exploreLSDs.alldiffs {asremlPlus} | R Documentation |
Explores the computed LSD values for pairwise differences between predictions.
Description
Given an alldiffs.object with an sed component, the LSDs are
calculated for all pairwise comparisons of predictions. It then calculates
(i) a table of frequencies of the LSD values, (ii) the distinct values of the LSDs
after rounding, (iii) various statistics from the LSD values, (iv) a measure of
the accuracy of each of the LSD statistics, (v) the numbers of false positives and
false negatives for each of the LSD statistics if pairwise comparisons are based
on the LSD statistic, (vi) the accuracy of each statistic in
representing the LSD values for each prediction and (vii) a matrix containing
the LSD values for comparing each pair of predictions. Histograms of the
frequencies can also be produced.
Usage
## S3 method for class 'alldiffs'
exploreLSDs(alldiffs.obj, LSDtype = "overall", LSDby = NULL,
LSDaccuracy = "maxAbsDeviation", alpha = 0.05, digits = 3,
retain.zeroLSDs = FALSE,
zero.tolerance = .Machine$double.eps ^ 0.5,
plotHistogram = FALSE, ...)
Arguments
alldiffs.obj |
An |
LSDtype |
A See |
LSDby |
A |
LSDaccuracy |
A |
alpha |
A |
digits |
A |
retain.zeroLSDs |
A |
zero.tolerance |
A |
plotHistogram |
A |
... |
Provision for passing arguments to functions called internally - not used at present. |
Details
The false positives and negatives are computed by comparing, for each pair of predictions
within each levels-combination of the LSDby variables, the
significance of the pair difference determined using (i) the true LSD that is computed from the
standard error of differences for the pair and (ii) the approximate LSD that is a statistic
computed from the true LSDs for all pairwise difference within each levels-combination of the
LSDby variables. The number of false positives is the number of pairwise differences for
which a difference is declared significant using the approximate LSD, but not using the true LSD.
The number of false negatives is the number of pairwise differences for which a difference is
declared nonsignificant using the approximate LSD, but significant using the true LSD.
The LSD accuracy for a set of LSDs is a function of the deviations of those LSDs and an LSD statistic calculated from them; the accuracy is expressed as a proportion of the value of the LSD statistic.
Value
A list with components
frequencies, distinct.vals, statistics, accuracy, per.pred.accuracy
and LSD:
frequenciesis adata.framewith the frequency distribution of the LSD values;distinct.valsis alist, each component of which contains the distinct values of the LSDs after rounding;statisticsis adata.framewith the minimum, quantile10, quantile25, mean, median, quantile75, quantile90, and maximum of the LSD values;accuracyis adata.framewith the accuracies of the minimum, quantile10, quantile25, mean, median, quantile75, quantile90, and maximum of the LSD values with respect to the values from which these statistics are calculated;false.posis adata.framewith the numbers of false positives for the pairwise comparisons within each levels-combination of theLSDbyvariables when each of the minimum, quantile10, quantile25, mean, median, quantile75, quantile90, and maximum of the LSD values is used as an approximate LSD in determining the significance of the pairwise differences;false.negis adata.framewith the numbers of false negatives for the pairwise comparisons within each levels-combination of theLSDbyvariables when each of the minimum, quantile10, quantile25, mean, median, quantile75, quantile90, and maximum of the LSD values is used as an approximate LSD in determining the significance of the pairwise differences;per.pred.accuracyis adata.framewith the accuracies of the minimum, quantile10, quantile25, mean, median, quantile75, quantile90, and maximum of the LSD values for a set of predictions when these statistics are used to represent the LSDs for the comparisons amongst the set of predictions;LSDis a squarematrixcontaining the LSD values for all pairwise comparisons of the predictions contained in the suppliedalldiffs.obj.
In the statistics, accuracy, false.pos and false.neg data.frames,
c is the number of pairwise comparisons on which the values in the same row are based.
The accuracy measure is specified by the LSDaccuracy argument.
Author(s)
Chris Brien
See Also
asremlPlus-package, plotLSDs.data.frame, plotLSDs.alldiffs,
plotLSDerrors.alldiffs, plotLSDerrors.data.frame, recalcLSD.alldiffs,
pickLSDstatistics.alldiffs, redoErrorIntervals.alldiffs
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:Type)
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:Type",
vcov = TS.vcov, tdf = den.df)
validAlldiffs(TS.diffs)
}
## Plot p-values for predictions obtained using asreml or lmerTest
if (exists("TS.diffs"))
{
##Explore the LSD values for predictions obtained using asreml or lmerTest
LSDstat <- exploreLSDs(TS.diffs, LSDtype = "factor.combinations",
LSDby = "Sources")
}