distribution_estimate: summarize_metrics

View source: R/distribution_estimate.R

distribution_estimateR Documentation

summarize_metrics

Description

A convenience function to perform overall metric analysis: mean, median, CI.

Usage

distribution_estimate(v, successes=NULL, num_quantiles=101, observed=FALSE)

Arguments

v

a vector of values to be analyzed (for nonbinary data), or number of trials (for binary data)

successes

number of successes (for binary data)

num_quantiles

number of quantiles to split into

observed

whether to generate the observed distribution (rather than the estimated distribution of the mean); default FALSE

Value

a data frame with the following columns:

quantiles

the estimated quantiles (0,0.01,0.02,...,1) for the mean, using a Beta-binomial estimate of p for binomial data, a bootstrapped quantile distribution for real-valued numbers

x

x values for plotting a lineplot of the estimated distribution

y

y values for plotting a lineplot of the estimated distribution

mids

mid values for plotting a barplot of the estimated distribution

lefts

left values for plotting a barplot of the estimated distribution

rights

right values for plotting a barplot of the estimated distribution

widths

width values for plotting a barplot of the estimated distribution

heights

height values for plotting a barplot of the estimated distribution

probabilities

probabilities indicating how much probability is contained in each barplot

Author(s)

Thomas Lotze <thomaslotze@thomaslotze.com>

Examples

metric_list = list(rbinom(n=100,size=1,prob=0.5),
                   rbinom(n=100,size=1,prob=0.7),
                   rpois(n=100, lambda=5))
distribution_estimate(length(metric_list[[1]]), sum(metric_list[[1]]))
distribution_estimate(length(metric_list[[2]]), sum(metric_list[[2]]))
de = distribution_estimate(metric_list[[3]])
plot(de$x, de$y, type="l")
barplot(de$heights, de$widths)
distribution_estimate(metric_list[[3]], observed=TRUE)

bandit documentation built on June 29, 2022, 5:05 p.m.