gglogistic: Plot logistic regression of probability from 0% to 100%...

View source: R/gglogistic.R

gglogisticR Documentation

Plot logistic regression of probability from 0% to 100% across a predictor.

Description

Plot logistic regression of probability from 0% to 100% across a predictor.

Usage

gglogistic(
  data,
  predictor,
  success.counts,
  failure.counts,
  treatment,
  replicate = NULL,
  line.var = "both",
  point.var = "none",
  boxplot.var = "none",
  inverse.var = "line",
  probability.of.interest = 0.5,
  xlabel = NULL,
  ylabel = NULL,
  treatment.label = NULL,
  treatment.colors = NULL,
  integer.x.breaks.by = NULL,
  fill.alpha = 0.25,
  replicate.alpha = 0.5,
  jitter.width = 0,
  dodge.width = 0,
  inverse.predict.digits = 3
)

Arguments

data

Data with continuous predictor and success and failure columns.

predictor

Continuous predictor for x-axis.

success.counts

Column representing number of successes per observation.

failure.counts

Column representing number of failures per observation.

treatment

Treatment variable.

replicate

Within-treatment replicates.

line.var

Variable to plot regression curves for: "both" (default), "treatment", "replicate", or "none".

point.var

Variable to plot points for: "both", "treatment", "replicate", or "none" (default). y-value represents fraction of successes in each treatment or replicate.

boxplot.var

Variable to plot boxplots for: "both", "treatment", "replicate", or "none" (default).

inverse.var

Variable to draw lines at inverse predictions for: "both", "treatment", "replicate", "none" or "line" (same as whatever was specified for line.var; default).

probability.of.interest

Calculate predictor value in each group that would yield this probability.

xlabel

Label for x-axis.

ylabel

Label for y-axis.

treatment.label

Label for treatment.

treatment.colors

Vector mapping treatment levels to colors.

integer.x.breaks.by

If specified, integer breaks in x-axis. Forces ggplot to break at integer values.

fill.alpha

Opacity in range [0,1] for fill of boxplots. Boxplots can be hard to see if there is a lot of data, and having a light fill color helps to distinguish them.

replicate.alpha

Opacity in range [0,1] to draw replicate geoms at when the same geom is also drawn for treatment. Helps distinguish treatment from replicate values.

jitter.width

If specified, amount to jitter points in x-axis. Useful if predictor was sampled at discrete steps that would otherwise cause points to be hard to tell apart.

dodge.width

If specified, amount to dodge replicate boxplots or groups of points by.

inverse.predict.digits

Number of digits to print for inverse predicted values.

Value

A ggplot object.

Examples

metamorphosis.data <- logisticat::metamorphosis()
head(metamorphosis.data) # Has columns for success and failure counts
logisticat::gglogistic(metamorphosis.data,
                       predictor=days,
                       success.counts=metamorphosed,
                       failure.counts=did.not.metamorphose,
                       treatment=ration,
                       replicate=beaker,
                       probability.of.interest=0.5)

Ergative/logisticat documentation built on May 17, 2022, 12:32 a.m.