Plot Output from fixedRegress()
plot_fixedRegress.RdProduces one of two ggplot2 visualisations from a fixedRegress() result
object, analogous to plot_randomRegress() for fixed-effects (BLUE) output.
Both plot types return a ggplot object that can be further customised
with the standard + operator.
Arguments
- res
A list returned by
fixedRegress().- type
Character string selecting the plot type. One of
"regress"(default) or"quadrant".- treatments
Character vector restricting which conditioned treatments are included.
NULL(default) includes all conditioned treatments.- highlight
Controls genotype annotation. One of:
"default"Automatically selects 6 genotypes using the polar-angle algorithm (3 top-right, 3 bottom-left).
- character vector
Highlight exactly the named genotypes.
NULLNo highlighting.
Default is
"default".- centre
Logical. If
TRUE(default), within-group means are subtracted from the x-axis (unconditional treatment BLUE) and, fortype = "regress", also from the y-axis. This removes the treatment fixed-effect mean so that the zero reference lines fall within the data and the quadrant concept is meaningful. Set toFALSEto display raw BLUEs including the treatment mean.- theme
A complete ggplot2 theme object. Default
ggplot2::theme_bw().- return_data
Logical. If
TRUEreturns the tidy data frame rather than the plot. DefaultFALSE.- ...
Additional arguments passed to the background
geom_point()call (e.g.size,alpha).
Details
The two type options are:
"regress"Grid of scatter plots faceted by BLUP pair (rows) and group (columns). Each panel plots the raw conditioned-treatment BLUEs (y) against the conditioning-treatment BLUEs (x) for one group × one treatment pair. A dotted OLS regression line is drawn and the slope \(\hat{\beta}\) is annotated in the top-left corner of each panel. Unlike the random-effects analogue the line need not pass through the origin because OLS includes an intercept.
"quadrant"Grid of scatter plots faceted by BLUP pair (rows) and group (columns). Each panel plots the response index (OLS residual, y) against the unconditional treatment BLUE (efficiency, x). Dotted zero reference lines divide each panel into four quadrants.
Variety highlighting — see plot_randomRegress() for the full
description of the polar-angle algorithm used to select the default six
genotypes. The same three archetypes (efficiency, balanced,
responsiveness) are chosen from the top-right and bottom-left quadrants of
the efficiency × response-index space, averaged across all groups.
The output data frames returned when return_data = TRUE use standardised
column names "Group" (the grouping variable) and "Genotype" (the
regression unit) regardless of the original column names in
res$blues.
Examples
if (FALSE) { # \dontrun{
res <- fixedRegress(model, term = "Treatment:Site:Genotype",
by = "Site", levs = c("T0", "T1", "T2"))
# Regression plot with default 6 highlighted genotypes
plot_fixedRegress(res)
# Quadrant plot
plot_fixedRegress(res, type = "quadrant")
# User-specified highlights
plot_fixedRegress(res, type = "quadrant",
highlight = c("Gen01", "Gen15"))
# Suppress highlighting
plot_fixedRegress(res, type = "regress", highlight = NULL)
# Retrieve tidy data frame
df <- plot_fixedRegress(res, type = "quadrant", return_data = TRUE)
} # }