redoErrorIntervals.alldiffs | R Documentation |
alldiffs.object
.Given an alldiffs.object
, adds or replaces error.intervals
for its prediction
component. If the backtransforms
component is
present, the transform.power
, offset
and scale
will be
retrieved from the backtransforms
attributes, ignoring the values for the
function's arguments, and the backtransformed
error.intervals
will also be calculated.
## S3 method for class 'alldiffs'
redoErrorIntervals(alldiffs.obj, error.intervals = "Confidence",
alpha = 0.05,
avsed.tolerance = 0.25, accuracy.threshold = NA,
LSDtype = NULL, LSDsupplied = NULL,
LSDby = NULL, LSDstatistic = "mean",
LSDaccuracy = "maxAbsDeviation",
retain.zeroLSDs = FALSE,
zero.tolerance = .Machine$double.eps ^ 0.5, ...)
alldiffs.obj |
An |
error.intervals |
A |
alpha |
A |
avsed.tolerance |
A
|
accuracy.threshold |
A |
LSDtype |
A If See |
LSDsupplied |
A |
LSDby |
A |
LSDstatistic |
A |
LSDaccuracy |
A |
retain.zeroLSDs |
A |
zero.tolerance |
A |
... |
further arguments passed to |
An alldiffs.object
with components
predictions
, vcov
, differences
, p.differences
sed
, LSD
and, if present in alldiffs.obj
, backtransforms
.
If error.intervals
is not "none"
, then the
predictions
component and, if present, the
backtransforms
component will contain columns for the lower
and upper values of the limits for the interval. The names of these
columns will consist of three parts separated by full stops:
1) the first part will be lower
or upper
;
2) the second part will be one of Confidence
,
StandardError
or halfLeastSignificant
;
3) the third component will be limits
.
The name of the response
, the term
, the classify
and
tdf
, as well as the degrees of freedom of the standard error, will be set
as attributes to the object.
Also, if error.intervals
is "halfLeastSignificant"
, then those of
LSDtype
, LSDby
and LSDstatistic
that are not NULL
will be added as attributes of the object and of the predictions frame
;
additionally, LSDvalues
will be added as attribute of the
predictions frame
, LSDvalues
being the LSD values used in
calculating the error.intervals
.
Chris Brien
recalcLSD.alldiffs
, exploreLSDs.alldiffs
,
pickLSDstatistics.alldiffs
,
predictPresent.asreml
, plotPredictions.data.frame
,
allDifferences.data.frame
,
as.alldiffs
, print.alldiffs
, sort.alldiffs
,
subset.alldiffs
,
as.Date
, predict.asreml
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 <- redoErrorIntervals.alldiffs(TS.diffs,
error.intervals = "halfLeastSignificant")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.