| plotLSDerrors.alldiffs {asremlPlus} | R Documentation |
Plots a map of the errors that occur in using the computed LSD values for pairwise differences between predictions.
Description
Produces a plot of the errors that occur in using the computed LSD values for
pairwise differences predictions by comparing the result obtained from using the
LSDs stored in the assignedLSD column of the LSD component of
the alldiffs.object with those computed from the sed
component using the t-value for the df stored in the tdf
attribute of the alldiffs.object.
The sed component is generally a matrix whose rows and columns
are labelled by the levels of one or more factors, the set of labels being
the same for rows and columns. The sections argument allows multiple
plots to be produced, one for each combination of the levels of the factors
listed in sections. Otherwise, a single plot is produced for all
observed combinations of the levels of the factors in the classify
attribute for the alldiffs.object. The plots are produced using
plotLSDerrors.data.frame. The order of plotting the levels of
one of the factors indexing the predictions can be modified using
sort.alldiffs.
Usage
plotLSDerrors(object, ...)
## S3 method for class 'alldiffs'
plotLSDerrors(object, alpha = 0.05, useIntervals = FALSE,
sections = NULL, gridspacing = 0, factors.per.grid = 0,
triangles = "both", title = NULL,
axis.labels = TRUE, axis.text.size = 12,
sep=",", colours = c("white","blue","red","grey"),
ggplotFuncs = NULL, printPlot = TRUE,
sortFactor = NULL, sortParallelToCombo = NULL,
sortNestingFactor = NULL, sortOrder = NULL,
decreasing = FALSE, ...)
Arguments
object |
An |
alpha |
A |
useIntervals |
A |
sections |
A |
gridspacing |
A |
factors.per.grid |
A |
triangles |
A |
title |
A |
axis.labels |
A |
axis.text.size |
A |
sep |
A |
colours |
A vector of colours to be passed to the |
ggplotFuncs |
A |
printPlot |
A |
sortFactor |
A |
sortParallelToCombo |
A |
sortNestingFactor |
A |
sortOrder |
A The following creates a |
decreasing |
A |
... |
Provision for passsing arguments to functions called internally - not used at present. |
Value
A list with components named LSDresults and plots.
The LSDresults component contains the data.frame with the columns Rows,
Columns, LSDresults, sections1 and sections2. This data.frame
is formed using the LSD and sed components of object and is used
by plotLSDerrors.data.frame in producng the plots. The plots
component contains a list of ggplot objects, one for each plot produced.
Multiple plots are stored in the plots component if the sections argument
is set and the plots are are named for the levels combinations of the sections.
Author(s)
Chris Brien
See Also
plotLSDerrors.alldiffs, plotLSDerrors.data.frame,
plotLSDs.data.frame,
exploreLSDs, sort.alldiffs, subset.alldiffs,
ggplot
Examples
##Subset WaterRunoff data to reduce time to execute
data(WaterRunoff.dat)
tmp <- subset(WaterRunoff.dat, Date == "05-18" & Benches != "3")
##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= tmp)
current.asrt <- as.asrtests(current.asr, NULL, NULL)
TS.diffs <- predictPlus.asreml(classify = "Sources:Type",
asreml.obj = current.asr, tables = "none",
wald.tab = current.asrt$wald.tab,
present = c("Type","Species","Sources"))
## 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 LSD values for predictions obtained using asreml or lmerTest
if (exists("TS.diffs"))
{
plotLSDerrors(TS.diffs, gridspacing = rep(c(3,4), c(4,2)))
plotLSDerrors(TS.diffs, sections = "Sources", axis.labels = TRUE)
}