Learn R Programming

plot3logit (version 3.2.0)

stat_conf3logit: Add the confidence regions of a field to a gg3logit plot

Description

stat_conf3logit() adds a field to a gg3logit plot.

Usage

stat_conf3logit(
  mapping = aes(),
  data = NULL,
  geom = "polygon",
  position = "identity",
  show.legend = NA,
  inherit.aes = TRUE,
  ...
)

Value

Layer of ggplot2 package, object of class LayerInstance.

Arguments

mapping

list of aesthetic mappings to be used for plot. Mandatory aesthetics should not be specified if field3loglit or multifield3logit object is passed to data. See secion Aesthetic mappings of gg3logit() for details.

data

a field3logit object, a multifield3logit object, or a data.frame structured like a fortified field3logit or a multifield3logit object.

geom

The geometric object to use to display the data for this layer. When using a stat_*() function to construct a layer, the geom argument can be used to override the default coupling between stats and geoms. The geom argument accepts the following:

  • A Geom ggproto subclass, for example GeomPoint.

  • A string naming the geom. To give the geom as a string, strip the function name of the geom_ prefix. For example, to use geom_point(), give the geom as "point".

  • For more information and other ways to specify the geom, see the layer geom documentation.

position

A position adjustment to use on the data for this layer. This can be used in various ways, including to prevent overplotting and improving the display. The position argument accepts the following:

  • The result of calling a position function, such as position_jitter(). This method allows for passing extra arguments to the position.

  • A string naming the position adjustment. To give the position as a string, strip the function name of the position_ prefix. For example, to use position_jitter(), give the position as "jitter".

  • For more information and other ways to specify the position, see the layer position documentation.

show.legend

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. It can also be a named logical vector to finely select the aesthetics to display. To include legend keys for all levels, even when no data exists, use TRUE. If NA, all levels are shown in legend, but unobserved levels are omitted.

inherit.aes

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. annotation_borders().

...

additional arguments passed through to ggtern.

See Also

Other gg functions: autoplot.Hfield3logit(), gg3logit(), stat_3logit(), stat_field3logit()

Examples

Run this code
# \donttest{
data(cross_1year)

mod0 <- nnet::multinom(employment_sit ~ gender + finalgrade, data = cross_1year)
field0 <- field3logit(mod0, 'genderFemale', conf = 0.95)

gg3logit(field0) + stat_conf3logit()
gg3logit(field0) + stat_field3logit() + stat_conf3logit()
# }

Run the code above in your browser using DataLab