View source: R/high_low_test.R
high_low_test | R Documentation |
Performs high to low digit tests vs probability of high to low digits by Benford's Law via chi square test (default) or binomial test
high_low_test(
digitdata,
data_columns = "all",
high = c(6, 7, 8, 9),
omit_05 = NA,
test_type = "chisq",
distribution = "Benford",
contingency_table = NA,
skip_first_digit = FALSE,
skip_last_digit = FALSE,
break_out = NA,
break_out_grouping = NA,
category = NA,
category_grouping = NA,
plot = TRUE,
remove_all_category_visualize = FALSE
)
digitdata |
A object of class |
data_columns |
The names of numeric columns of data to be analyzed. Default can be 'all', where using all data columns in |
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. |
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". |
distribution |
'Benford' or 'Uniform'. Case insensitive. Specifies the distribution the chi square test is testing against. Default to 'Benford'. |
contingency_table |
The user-input probability table of arbitrary distribution. Overwrites
|
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.
|
break_out |
|
break_out_grouping |
A list of arrays, or defaulted to NA. Only effective if
|
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
|
plot |
TRUE or FALSE or 'Save': If TRUE, display the plots and return them. If 'Save', return the plots but suppress display. If FALSE, no plot is produced. Default to TRUE. |
remove_all_category_visualize |
TRUE or FALSE: If TRUE, remove visualization of 'All Category' dataset for plots |
A table of p-values for high low test on each category
A table of sample sizes for high low test on each category
Plots for each category if plot = TRUE or 'Save'
high_low_test(digitdata, high=c(5, 6,7,8,9))
high_low_test(digitdata, skip_first_digit=TRUE, break_out='col_name', test_type='binom')
high_low_test(digitdata, high=c(5,6,9), omit_05=0, skip_last_digit=TRUE, break_out='col_name', category='category_name')
high_low_test(digitdata, data_columns='c(col_name1, col_name2)', high=9, break_out='col_name', category='category_name', plot='Save')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.