ggs_separation: Separation plot for models with binary response variables

Description Usage Arguments Value References Examples

View source: R/ggs_separation.R

Description

Plot a separation plot with the results of the model against a binary response variable.

Usage

1
2
3
4
5
6
7
ggs_separation(
  D,
  outcome,
  minimalist = FALSE,
  show_labels = FALSE,
  uncertainty_band = TRUE
)

Arguments

D

Data frame whith the simulations. Notice that only the fitted / expected posterior outcomes are needed, and so either the previous call to ggs() should have limited the family of parameters to only pass the fitted / expected values. See the example below.

outcome

vector (or matrix or array) containing the observed outcome variable. Currently only a vector is supported.

minimalist

logical, FALSE by default. It returns a minimalistic version of the figure with the bare minimum elements, suitable for being used inline as suggested by Greenhill, Ward and Sacks citing Tufte.

show_labels

logical, FALSE by default. If TRUE it adds the Parameter as the label of the case in the x-axis.

uncertainty_band

logical, TRUE by default. If FALSE it removes the uncertainty band on the predicted values.

Value

A ggplot object

References

Fernández-i-Marín, Xavier (2016) ggmcmc: Analysis of MCMC Samples and Bayesian Inference. Journal of Statistical Software, 70(9), 1-20. doi:10.18637/jss.v070.i09

Greenhill B, Ward MD and Sacks A (2011). The separation plot: A New Visual Method for Evaluating the Fit of Binary Models. _American Journal of Political Science_, 55(4), 991-1002, doi:10.1111/j.1540-5907.2011.00525.x.

Greenhill, Ward and Sacks (2011): The separation plot: a new visual method for evaluating the fit of binary models. American Journal of Political Science, vol 55, number 4, pg 991-1002.

Examples

1
2

Example output

Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: tidyr
Loading required package: ggplot2
Loading required namespace: coda

ggmcmc documentation built on Feb. 10, 2021, 5:10 p.m.