single_high_low_test: Perform a single high low test. Helper function for...

View source: R/high_low_test.R

single_high_low_testR Documentation

Perform a single high low test. Helper function for high_low_test.

Description

Perform a single high low test. Helper function for high_low_test.

Usage

single_high_low_test(
  digitdata,
  contingency_table,
  data_columns,
  high,
  omit_05,
  skip_first_digit,
  skip_last_digit,
  category,
  category_grouping,
  test_type
)

Arguments

digitdata

A object of class DigitAnalysis.

contingency_table

The user-input probability table of arbitrary distribution. Overwrites distribution if not NA. Must be a dataframe of the form as benford_table. Defaulted to NA.

  • Check out load(file = "data/benford_table.RData") to see the format of benford_table

data_columns

The names of numeric columns of data to be analyzed. Default can be 'all', where using all data columns in numbers df in digitdata; an array of column names, as characters; a single column name, as character.

high

An numeric array of digits or a single number that will be classified as high digits. Defaulted to c(6,7,8,9).

omit_05

Whether to omit 0 or both 0 and 5. If omit both 0 and 5, pass in c(0,5) or c(5,0); if omit only 0 pass in 0 or c(0); if omit neither, pass in NA. Default to NA.

skip_first_digit

TRUE or FALSE: If TRUE, skip first digit place before analysis. Default to FALSE.

skip_last_digit

TRUE or FALSE: If TRUE, skip last digit place before analysis, since we don't want tests to overlap. Default to FALSE. skip_last_digit should overwrite digit_places and skip_first_digits.

category

The column for splitting the data into sectors for separate analysis. The second division (usually variables) shown in plots.

category_grouping

A list of arrays, or defaulted to NA. Only effective if category is not NA.

  • Each the names of the elements in the list is the category name

  • Each array contains the values belonging to that category

  • If it is remain as NA as default, while category is not NA, then category_grouping will default to every individual item in category will be in a separate group.

  • e.g. category_grouping = list(group_1=c(category_1, category_2, ...), group_2=c(category_10, ...), group_3=c(...))

test_type

Specifies whether to perform a binomial test on high vs low digit frequency weighted averaged across digit places with "binom", or a chi square test on high vs. low by each digit place with "chisq". Defaulted to "chisq".

Value

p_values table of high low test for input data from digitdata.


jlederluis/digitanalysis documentation built on Nov. 5, 2023, 11:46 a.m.