[英]Benford’s Law by group in R
I am attempting to implement Benford's Law using the benford.analysis package in R across all vendors' invoices.我正在尝试在所有供应商的发票中使用 R 中的 benford.analysis 包来实施本福德定律。 Over the entire dataset the data confirms.
在整个数据集中,数据证实了这一点。 I'm trying to find a way to group by vendor to determine if any individual vendor is displaying fraud indicators by not conforming.
我正在尝试找到一种按供应商分组的方法,以确定是否有个别供应商通过不符合标准来显示欺诈指标。 Is there a way to break out non-conforming by group?
有没有办法按组打破不合格?
Here is a way to use group_by
and group_map
to create benford.analysis
plots for each group.这是一种使用
group_by
和group_map
为每个组创建benford.analysis
图的方法。 In this example, grouping Iris data by Species and performing analysis on Sepal Length variable.在此示例中,按物种对鸢尾花数据进行分组并对萼片长度变量进行分析。
In group_map()
, .x
means the grouped subset data, and .y
means the name of the group.在
group_map()
中, .x
表示分组的子集数据, .y
表示组的名称。
library(dplyr)
library(benford.analysis)
iris %>%
group_by(Species) %>%
group_map(.f = ~ plot(benford(.x$Sepal.Length)))
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.