plotAssignments: Plot assignment distributions

View source: R/plotAssignments.R

plotAssignmentsR Documentation

Plot assignment distributions

Description

Plot individual assignment probability distributions.

Usage

plotAssignments(
  probs,
  orig,
  type = NULL,
  ylab = NULL,
  freq.sep.line = TRUE,
  plot = TRUE
)

Arguments

probs

matrix or data.frame of individual assignment probabilities. Each column represents probability of assignment to that group and rows sum to one.

orig

vector of original group assignments

type

either area for stacked continuous area plot or bar for discrete stacked bar chart. The latter is prefered for small numbers of cases. If not specified, a bar chart will be used if all classes have <= 30 cases.

ylab

label for y-axis

freq.sep.line

put frequency of original group on second line in facet label? If FALSE, labels are single line. If NULL frequencies will not be included in labels.

plot

display the plot?

Value

the ggplot object is invisibly returned.

Author(s)

Eric Archer eric.archer@noaa.gov

Examples

n <- 40
probs <- abs(c(rnorm(n, 80, 10), rnorm(n, 20, 10)))
probs <- (probs - min(probs)) / max(probs)
probs <- cbind(probs, 1 - probs)
colnames(probs) <- NULL
orig <- rep(c("Group.1", "Group.2"), each = n)

plotAssignments(probs, orig)

n <- 15
probs <- abs(c(rnorm(n, 80, 10), rnorm(n, 20, 10)))
probs <- (probs - min(probs)) / max(probs)
probs <- cbind(probs, 1 - probs)
colnames(probs) <- NULL
orig <- rep(c("Group.1", "Group.2"), each = n)

plotAssignments(probs, orig)


swfscMisc documentation built on Sept. 8, 2023, 5:55 p.m.