Description Usage Arguments Functions Aesthetics Computed Variables Examples
This geom may be used to plot the density of any type of numeric variable but the displayed intervals may not be informative if the distribution deviates too much from a unimodal, symmetric distribution.
1 2 3 4 5 6 7 8 9 10 11 | geom_posterior(mapping = NULL, data = NULL, stat = "DensityCI",
position = "spread", ..., draw_ci = TRUE, draw_sd = TRUE,
midline = "#767698", brighten = TRUE, mirror = FALSE,
interp_thresh = NULL, na.rm = FALSE, show.legend = NA,
inherit.aes = TRUE)
stat_density_ci(mapping = NULL, data = NULL, geom = "Posterior",
position = "spread", ..., center_stat = "median", ci_width = 0.9,
interval_type = "ci", bw = "nrd0", adjust = 1,
kernel = "gaussian", cut = 1, n = 1024, trim = 0.01,
na.rm = FALSE, show.legend = NA, inherit.aes = TRUE)
|
mapping |
Set of aesthetic mappings created by |
data |
The data to be displayed in this layer. There are three options: If A A |
stat |
Used to override the default connection between |
position |
Position adjustment, either as a string, or the result of a call to a position adjustment function. |
... |
Other arguments passed on to |
draw_ci |
geom. Toggles drawing of the confidence interval lines and segments. |
draw_sd |
geom. Toggles drawing of the standard deviation interval lines and segments. |
midline |
geom. Color of the vertical, center line. Set to |
brighten |
geom. Numeric adjustments to the fill color. A value above 1 increases brightness, below decreases. Should be of length 1 or 5, otherwise values are recycled |
mirror |
geom. Show standard densities ( |
interp_thresh |
geom. If the number of samples used to estimate the density is low, this will result in gaps between segments. This argument decides to interpolate points based on gap proportion for a segment. |
na.rm |
If |
show.legend |
logical. Should this layer be included in the legends?
|
inherit.aes |
If |
geom |
Use to override the default connection between |
center_stat |
stat. character string of method to compute the
distribution's central tendency, such as |
ci_width |
stat. Width of the distribution's confidence/highest density interval, e.g., 0.95 |
interval_type |
stat. method of computing the interval, either |
bw |
The smoothing bandwidth to be used. If numeric, the standard
deviation of the smoothing kernel. If character, a rule to choose the
bandwidth, as listed in stats::bandwidth. If the bandwidth character
starts wit a |
adjust |
A multiplicate bandwidth adjustment. This makes it possible
to adjust the bandwidth while still using the a bandwidth estimator.
For example, |
kernel |
Kernel. See list of available kernels in |
cut |
The values to use for the start and end of the density estimation
are |
n |
number of equally spaced points at which the density is to be
estimated, should be a power of two, see |
trim |
If a value between 0 and 1 is given, trim the tails of |
geom_posterior
: geom_posterior Posterior Geom
stat_density_ci
: stat_density_ci Computes a distribution density and
confidence intervals for each group
geom_posterior
understands the following aesthetics (required aesthetics
are in bold):
x
y
xmin
xmax
alpha - colour
fill
group
linetype
size
weight
stat_density_ci:
density: density estimate from stats::density
scaled: Normalized density values: density / max(density)
count: Number of samples at density level: (density / sum(density)) * n
xmin: minimum value of x
from the data
cil: cil cutoff value based on ci_width
sdl: central value minus 1 sd of x
mid: value of central tendency
sdu: central value plus 1 sd of x
ciu: ciu cutoff value based on ci_width
xmax: maximum value of x
from the data
position_spread
ymin: minimum value of y
for each group in a panel.
ymax: maximum value of y
for each group in a panel.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(ggplot2)
x <- data_normal_sample(mu = c(-1, 0, 1), n = 500)
p <- ggplot(x, aes(x = value))
p + geom_posterior()
p + geom_posterior(aes(y = Condition))
p + geom_posterior(aes(y = GroupScore, fill = Condition))
p + geom_posterior(aes(y = GroupScore, fill = Group),
brighten = c(1.3, 0, -1.3),
position = position_spread(
height=0.5,
padding = 0))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.