pickLSDstatistics.alldiffs | R Documentation |
Given an alldiffs.object
with an sed
component,
exploreLSDs.alldiffs
is used to calculate the LSD values for each set of
prediction comparisons specified by LSDtype
and LSDby
using each of the
statistics minimum
, q10
, q25
, mean
, median
, q75
,
q90
and maximum
. Then the numbers of false positives and
false negatives resulting from employing each of the calculated LSDs is obtained. For
each set of comparisons, the LSD value(s) with the lowest number of false positives are
identified and, from these, the smallest value with the lowest number of false negatives.
That is, a conservative approach is taken to picking LSD values by putting the priority on
avoiding false positives. Before using the LSDstatistics that this function suggests, the number
of false positives and negatives generated by them should be checked. For example, it may be
that there are too many false negatives and a better balance between the numbers of false
positives and negatives can be identified using exploreLSDs.alldiffs
,
## S3 method for class 'alldiffs'
pickLSDstatistics(alldiffs.obj,
LSDtype = "overall", LSDby = NULL,
alpha = 0.05, digits = 3,
false.pos.wt = NULL, retain.zeroLSDs = FALSE,
zero.tolerance = .Machine$double.eps ^ 0.5,
...)
alldiffs.obj |
An |
LSDtype |
A See |
LSDby |
A |
alpha |
A |
digits |
A |
false.pos.wt |
When it is not If, amongst the LSD statistices, the least number of false negatives that occurs is m,
then for a particular statistic with p the number of false positives, n the number
of false negatives and w the value of |
retain.zeroLSDs |
A |
zero.tolerance |
A |
... |
Provision for passing arguments to functions called internally - not used at present. |
A character
of length one for LSDby
set to overall
or of length equal to the
number of observed combinations of the values of the factors
and numerics
in LSDby
. Each element of the returned character
is one of minimum
,
q10
, q25
, mean
, median
, q75
, q90
or maximum
,
reflecting the value(s) of the LSD from amongst those calculated that minimizes the number of false
positives; if there is more than one such value, then the element will be correspond to the value
of the LSD from amongst those with the minimum number of false positives that minimizes
the number of false negatives.
Chris Brien
asremlPlus-package
, exploreLSDs.alldiffs
plotLSDs.data.frame
,
plotLSDs.alldiffs
,
plotLSDerrors.alldiffs
, plotLSDerrors.data.frame
, recalcLSD.alldiffs
,
redoErrorIntervals.alldiffs
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"))
{
##Pick the LSD values for predictions obtained using asreml or lmerTest
LSDstat <- pickLSDstatistics(TS.diffs)
TS.diffs <- redoErrorIntervals(TS.diffs, LSDstatistic = LSDstat)
TS.diffs$LSD
LSDstat <- pickLSDstatistics(TS.diffs, LSDtype = "factor.combinations",
LSDby = "Sources")
TS.diffs <- redoErrorIntervals(TS.diffs, LSDtype = "factor.combinations",
LSDby = "Sources", LSDstatistic = LSDstat)
TS.diffs$LSD
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.