data2hist: From real data to distributionH.

View source: R/Utility.R

data2histR Documentation

From real data to distributionH.

Description

From real data to distributionH.

Usage

data2hist(
  data,
  algo = "histogram",
  type = "combined",
  qua = 10,
  breaks = numeric(0),
  epsilon = 0.01
)

Arguments

data

a set of numeric values.

algo

(optional) a string. Default is "histogram", i.e. the function "histogram" defined in the histogram package.
If "base" the hist function is used.
"FixedQuantiles" computes the histogram using as breaks a fixed number of quantiles.
"ManualBreaks" computes a histogram where braks are provided as a vector of values.
"PolyLine" computes a histogram using a piecewise linear approximation of the empirical cumulative distribution function using the "Ramer-Douglas-Peucker algorithm", https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm. An epsilon parameter is required. The data are scaled in order to have a standard deviation equal to one.

type

(optional) a string. Default is "combined" and generates a histogram having regularly spaced breaks (i.e., equi-width bins) and irregularly spaced ones. The choice is done accordingly with the penalization method described in histogram. "regular" returns equi-width binned histograms, "irregular" returns a histogram without equi-width histograms.

qua

a positive integer to provide if algo="FixedQuantiles" is chosen. Default=10.

breaks

a vector of values to provide if algo="ManualBreaks" is chosen.

epsilon

a number between 0 and 1 to provide if algo="PolyLine" is chosen. Default=0.01.

Value

A distributionH object, i.e. a distribution.

See Also

histogram function

Examples

data <- rnorm(n = 1000, mean = 2, sd = 3)
mydist <- data2hist(data)
plot(mydist)

Airpino/HistDAWass documentation built on Jan. 30, 2024, 7:53 p.m.