stat_fit_augment
fits a model and returns the data
augmented with information from the fitted model, using package 'broom'.
stat_fit_augment(mapping = NULL, data = NULL, geom = "smooth",
method = "lm", method.args = list(formula = y ~ x),
augment.args = list(), level = 0.95, y.out = ".fitted",
position = "identity", na.rm = FALSE, show.legend = FALSE,
inherit.aes = TRUE, ...)
The aesthetic mapping, usually constructed with
aes
or aes_string
. Only needs
to be set at the layer level if you are overriding the plot defaults.
A layer specific dataset - only needed if you want to override the plot defaults.
The geometric object to use display the data
character.
list of arguments to pass to method
.
list of arguments to pass to broom:augment
.
numeric Level of confidence interval to use (0.95 by default)
character (or numeric) index to column to return as y
.
The position adjustment to use for overlapping points on this layer
logical indicating whether NA values should be stripped before the computation proceeds.
logical. Should this layer be included in the legends?
NA
, the default, includes if any aesthetics are mapped. FALSE
never includes, and TRUE
always includes.
If FALSE
, overrides the default aesthetics, rather
than combining with them. This is most useful for helper functions that
define both data and aesthetics and shouldn't inherit behaviour from the
default plot specification, e.g. borders
.
The output of augment
is
returned as is, except for y
which is set based on y.out
and
y.observed
which preserves the y
returned by the
broom::augment
methods. This renaming is needed so that the geom
works as expected.