plotbinary: Plot raw data for binomial data

Description Usage Arguments Value Examples

View source: R/plotbinary.R

Description

Plot raw data for binomial data

Usage

1
2
3
plotbinary(xdata, response, pred, pstructure = NULL, agg = FALSE,
  aggcol = NULL, xlimsglobal = FALSE, cexfac = pi, bin = NULL,
  pch = NULL, col = NULL, ylim = NULL, ...)

Arguments

xdata

a data frame

response

character, the column name with the response variable (y-axis)

pred

character, the column name with the response variable (x-axis)

pstructure

optional, a named list the values for subsetting. Names of that list have to correspond to column names in xdata

agg

logical, should data be first aggregated over a third variable (e.g. individual)

aggcol

character, the column name for aggregation

xlimsglobal

logical of length 1, or numeric of length two

cexfac

expansion factor for points

bin

optional, numeric of length 1 or longer, if supplied the data will be binned along 'pred' in either a specific number of bins (if length 1) or along a specific break points (of length >1)

pch

optional point character (by default 16)

col

optional colour (by default transparent grey)

ylim

optional vector of length 2 for y-axis limits (by default c(0, 1))

...

more arguments for the plot, for example xlab=

Value

A plot

Examples

1
2
3
4
5
6
7
8
xdata <- data.frame(resp = sample(c(0,1), 1000, TRUE), ID = sort(sample(letters[1:20], 1000, TRUE)),
pred=sort(rnorm(1000))+rnorm(1000), cat1 = sample(1:3, 1000, TRUE), cat2 = sample(1:3, 1000, TRUE),
cat3 = sample(1:3, 1000, TRUE))
plotbinary(xdata = xdata, response = "resp", pred = "pred", agg = TRUE, aggcol = "ID")
plotbinary(xdata = xdata, response = "resp", pred = "pred", agg = TRUE, aggcol = "ID", cexfac = 1)

plotbinary(xdata = xdata, response = "resp", pred = "pred", agg = FALSE)
plotbinary(xdata = xdata, response = "resp", pred = "pred", agg = FALSE, bin=30)

gobbios/cfp documentation built on July 15, 2018, 3:45 p.m.