second_order_transf: Second-Order Transformation to create Benford Set

View source: R/second_order_test.R

second_order_transfR Documentation

Second-Order Transformation to create Benford Set

Description

From some data distributions it is expected that they don't follow Benford's Law. In such cases it is annying that you can't use Benford's Law to evaluate the data. However, after ordering and taking the differences between these numbers and multiplying with a constant, the transformed data should conform to Benford's Law.

Usage

second_order_transf(numbers, const_multiplier = 10^6)

Arguments

numbers

Numeric Vector

const_multiplier

Integer. Constant used to multiply the sorted differences.

Details

This transformation can be applied to Normal, Uniform, Gamma and Triangular Distributions.

Value

Numeric vector

Examples

# generate some numbers
numbers <- rnorm(1000)

# assure data complies to a Benford Set
tranformed_numbers <- second_order_transf(numbers)

# Now the data must conform to Benford's Law
table(first_digit(tranformed_numbers))

Glender/BenfordStats documentation built on April 24, 2022, 9:01 p.m.