I have a dataset on avoided maritime accidents (near-miss) that looks like this:

[dataset of avoided maritime accidents1

All variables are categorical (type=1-3, position=1-5, area=1-5, risk=1-7, 4 columns, 525 rows - every row is 1 near miss described) and I encoded them in R.

From my own and other experiences, I know that accident avoidance data are often fabricated to meet bureaucratic forms for future inspections. If there are no avoided accidents, almost every company expects you to invent and report them anyway.

Before I do any analysis of this set I would like to test if there is significant fabricated data.

I am familiar with Benford's law (for economics and finance frauds), but I am interested in the following:

  1. How to use Benford's law when it comes to categorical variables?
  2. Is there are other (statistical or ML) ways to detect fabricated data in raw data?
  3. If not which methods do you recommend to analyze and find any structure this dataset?
  • $\begingroup$ Interesting setting, but I don't see how Benford's law could possibly apply. Instead, I would think carefully about what you might expect various statistics to look like in the absence of fraud. For example, might the number of accidents on a ship per year follow the Poisson distribution if accidents arrive randomly at some constant rate? If your intuition is indeed correct, there may be unusually few ships or voyages with 0 near misses compared to the Poisson distribution. (The arrival rate and length of time almost certainly vary between ships which could make this analysis kind of tricky.) $\endgroup$ Jan 2, 2021 at 17:20
  • $\begingroup$ The general approach I outlined above is to argue some pattern would be extremely unusual with accurate data. That may not be possible though. If you had observations clearly known to be fraudulent and not fraudulent, there's more you could do. (eg. train a logistic a regression on the labelled data.) $\endgroup$ Jan 2, 2021 at 17:32
  • $\begingroup$ May i use benford's law if i normalize categorical variables, scale them to the range 0-1? I read that Benfordow's law also applies to continuous variables, e.g., physical constants? I will test the Poisson distribution, and I intend to do a logistic regression with what I have - the y variable will be the cause of near miss (human factor, equipment ..), but i don't know what to do if i don't get any structure and i can't proove that data is half fake? $\endgroup$ Jan 2, 2021 at 18:55
  • $\begingroup$ What do you mean by normalize a categorical variable. That doesn't make sense to me at all. Benford's law isn't some magical incantation applicable anytime you see a number. Speaking loosely, the leading digit of a random variable X may follow Benford's law when distribution of $\log X$ is uniform over an appropriately wide interval (or other related situations). This can arise when there's exponential growth (eg. revenues grow some random percentage each month). How is that in any way related to categorical variables (eg. equipment, personal injury..) where you don't even have numbers? $\endgroup$ Jan 2, 2021 at 19:31
  • $\begingroup$ If a number falls in $[10, 20)$, it will have a leading digit of 1. If it falls in $[80, 90)$, it will have a leading digit of 8. While the interval $[10, 20)$ and $[80, 90)$ may be the same length, in log space, the interval $[\log 10, \log 20)$ is much larger than the interval $[\log 80, \log 90)$. If the probability that X falls in $[10, 20)$ is proportional to $\log 20 - \log 10$ etc..., then you get Benford's law for the leading digit of $X$. $\endgroup$ Jan 2, 2021 at 19:45

1 Answer 1


Benford's law applies only to data whose values contain information. Categorical labels do not have values containing any information; in other words you could swap the labels and the categorization would still apply, but the values would have no meaning.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.