test_veris_consistency: Test whether two enumerations are basically equal

View source: R/ci.R

test_veris_consistencyR Documentation

Test whether two enumerations are basically equal

Description

This is most useful for testing an enumerations whether an enumeration has stayed the same since last year. It functions by creating an null distribution around the observed proportion, and then checking the probability of the proportion being 0 (i.e. no change).

Usage

test_veris_consistency(
  chunk,
  Ea,
  Eb,
  ci.level = 0.05,
  reps = 1000,
  quietly = FALSE,
  visualize = FALSE
)

Arguments

chunk

getenumCI() object

Ea

Enumeration A. e.g. "action.Error"

Eb

Enumeration B. e.g. "action.Misuse"

ci.level

the confidence level to test against

reps

number of simulations to conduct

quietly

do not produce textual output

visualize

produce visual output

Details

Technically instead of 'true/false', the language should really be along the lines of "we have evidence for the alternative hypothesis ..." or "we do not have evidence to go against our original null hypothesis ...", but for simplicity we have left it the way it is.

Value

a logical TRUE/FALSE to the hypothesis

Examples

## Not run: 
tmp <- tempfile(fileext = ".dat")
download.file("https://github.com/vz-risk/VCDB/raw/master/data/verisr/vcdb.dat", tmp, quiet=TRUE)
load(tmp, verbose=TRUE)
vcdb %>%
  filter(timeline.incident.year %in% 2015:2020) %>%
  filter(attribute.confidentiality.data_disclosure.Yes) %>%
  verisr::getenumCI2020(
    "attribute.confidentiality.data.variety", 
    by="plus.dbir_year") %>%
  filter(!is.na(by)) %>%
  filter(enum == "Bank")  %>%
  select(-enum) %>%
  rename(enum = by)  %>%
  verisr::test_veris_consistency(Ea="2019", Eb="2020")

## End(Not run)

vz-risk/verisr documentation built on Aug. 5, 2023, 4:34 a.m.