ggbootUV: Univariate bootstrap plot

View source: R/ggbootUV.R

ggbootUVR Documentation

Univariate bootstrap plot

Description

Plots a sample statistic, such as the mean or median, and associated bootstrapped 95% confidence intervals for specified subsets of observations. Facilitates hypothesis testing by allowing a) application of the Benjamini-Hochberg procedure to control the alse discovery rate and b) specification of a minimum effect size.

Usage

ggbootUV(data, resp, xAxis, col = NULL, facet = NULL, nullBFactor = 10,
  diff = NULL, calcStat = "mean", B = 10, seB = 200,
  pMethod = "percT", fdr = 0.01, altSide, nSide = 1, ciMethod = "bca",
  alpha = 0.05, minEff = 0, hLineVec = NULL, nullValue = 0,
  xLab = NULL, yLab = "Response", xAxisLabVec = NULL, rotXText = FALSE,
  remXAxisMarks = FALSE, pointSize = 2, errBarSize = 1,
  errBarSizeRatio = 2, errBarAlpha = 0.7, errBarAlphaRatio = 2,
  eqErrBarWidth = TRUE, errBarLineType = "dotted", colLabName = NULL,
  colourVec = c("darkorchid1", "springgreen2", "maroon1", "dodgerblue", "red",
  "yellow3", "cyan2", "orange2"), colLabVec = NULL, facetLabVec = NULL,
  facetScale = "free", nCol = 2, plotTblName = NULL,
  fontScaleFactor = 1, lineScaleFactor = 1, hLineFactor = 1,
  bootT = TRUE, trim = 0.2, bootSECorr = FALSE)

Arguments

data

dataframe. Has one row per observation and the column names specified below.

resp

unquoted expression. Response variable name.

xAxis

unquoted expression. X-axis variable name.

col

unquoted expression. Colour variable name.

facet

unquoted expression. Facet variable name.

diff

unquoted expression. Difference variable name. Must be a binary variable, preferrably ('0','1') as then it is clear that the difference is the amount by which the observations labelled '1' are greater than the observations labelled '0'.

calcStat

function olr character. Bootstrap statistic function. Functions other than mean or median used at own risk.

B

integer. Number of bootstrap samples per subgroup.

pMethod

"perc" or "percT". Method to use for calculating p-values. Both uses the bootstrap percentile method, but "perc" does this on the mean or median, whilst "percT" does this on the t-statistic based on the mean or median.

fdr

numeric. False discovery rate.

nSide

1 or 2. Number of sides of the hypothesis tests.

ciMethod

"perc" or "bca". method to use to calculate confidence intervals. Both use bootstrap samples, but "perc" uses the percentile method and "bca" the bias-corrected and adjusted method.

alpha

numeric. 1-alpha is the coverage of the confidence intervals.

minEff

numeric. Minimum effect size. Default is 0.

hLineVec

numeric vector. Heights of dashed horizontal lines to plot. Useful for indicating minimum effect size.

nullValue

numeric. Null hypothesis value for statistic.

xLab, yLab

characeter. X- and y-axis titles. Optional.

xAxisLabVec

named character vector. Labels for x-axis variable. Optional.

rotXText

logical. If TRUE, then the x-axis text is rotated 90 degrees clockwise.

remXAxisMarks

logical. If TRUE, then the x-axis ticks and text are removed.

pointSize

numeric. Size of plot points

errBarSize

numeric. Size of error bar

errBarSizeRatio

numeric. How many times larger the size is of the statistically significant error bars than the non-statistically significant bars are.

errBarAlpha

numeric. Error bar alpha

errBarAlphaRatio

numeric. How many times greater the alpha is of the statistically significant error bars than the non-statistically significant bars are.

eqErrBarWidth

logical. If TRUE, then the error bars are made the same width in each facet. Otherwise the error bars automatically span the entire facet, however many x-axis entries there are.

colLabName

character. Name for colour legend. Optional.

colourVec

character vector. Colours for colour scale. Optional. Label with factor levels to match levels to colours manually.

colLabVec

named character vector. Labels for colour variable. Optional.

facetScale

'free', 'free_x' or 'free_y'. Facet scale.

nCol

numeric. Number of columns to use.

plotTblName

character. If not NULL, then the dataframe used to plot is saved to global environment with name plotTblName.

fontScaleFactor

numeric. Factor by which to scale the text size from the default.

lineScaleFactor

numeric. Factor by which to scale the line size from the default.

hLineFactor

numeric. Factor by which to scale the horizontal line size from the default.

altSde

'high', 'low' or 'both'. Character specifying the alternative hypothesis relative to the null hypothesis. Note that you must still specify nSide, even if altSide is specified.

facetlabeVec

named character vector. Labels for facet fariable. Optional.

sigIndType

character vector. Must contain at least one of "lineType", "alpha" and "size". The statistically significant and non-statistically significant error bars will then differ by this aesthetic.

Value

a ggplot2 object


MiguelRodo/ggboot documentation built on Nov. 9, 2023, 5:45 p.m.