plotLSDs.alldiffs {asremlPlus} | R Documentation |
Plots a heat map of computed LSD values for pairwise differences between predictions.
Description
Produces a heat-map plot of the computed LSD values for pairwise differences between
predictions by multiplying the values stored in the sed
component of an
alldiffs
object by the t
-value for the df
stored in the
tdf
attribute of the object.
This 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
plotLSDs.data.frame
. The order of plotting the levels of
one of the factors indexing the predictions can be modified using
sort.alldiffs
.
Usage
plotLSDs(object, ...)
## S3 method for class 'alldiffs'
plotLSDs(object, alpha = 0.05,
sections = NULL, gridspacing = 0, factors.per.grid = 0,
triangles = "both",
title = NULL, axis.labels = TRUE, axis.text.size = 12,
sep=",", colours = RColorBrewer::brewer.pal(3, "Set2"),
ggplotFuncs = NULL, printPlot = TRUE,
sortFactor = NULL, sortParallelToCombo = NULL,
sortNestingFactor = NULL, sortOrder = NULL,
decreasing = FALSE, ...)
Arguments
object |
An |
alpha |
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 LSDs
and plots
.
The LSDs
component contains the data.frame
with the columns Rows
,
Columns
, LSDs
, sections1
and sections2
. This data.frame
is
formed using the sed
component of object
and is used by
plotLSDs.data.frame
in producng the plot. 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
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"))
{
plotLSDs(TS.diffs, gridspacing = rep(c(3,4), c(4,2)))
plotLSDs(TS.diffs, sections = "Sources", axis.labels = TRUE)
}