Bitcoin Forum
May 07, 2024, 09:57:43 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Bitcoin price and Benford's law  (Read 99 times)
trantute2 (OP)
Hero Member
*****
Offline Offline

Activity: 784
Merit: 544



View Profile
October 02, 2019, 06:16:25 AM
 #1

The first digit of numbers often follow Benford's law. Manipulation of those numbers by humans can be detected via corresponding statistic tests since humans cannot produce numbers following the needed distribution(s) (except they use a computer and know, that the original data follows Benford's law):

https://en.wikipedia.org/wiki/Benford%27s_law
https://en.wikipedia.org/wiki/Benford%27s_law#Price_digit_analysis

Now something to think about and to discuss (but maybe I used the following tools wrongly):

Some R:
https://www.rdocumentation.org/packages/benford.analysis/versions/0.1.5

Code:
library(anytime); # für Zeitumrechnung
library(benford.analysis); # für Benford

temp <- tempfile();
download.file("https://api.bitcoincharts.com/v1/csv/bitstampUSD.csv.gz", temp);
table <- read.csv(gzfile(temp));
unlink(temp);

rm(temp);
gc();

# Benennung der Spalten
colnames(table) <- c("EPOCH", "PRICE", "VOLUME");

# Anfügen einer neuen Spalten mit den Daten (Datums), da ansonsten Epochs
table <- cbind(table, "DATE"=anydate(table[,1], "CEST"));

x <- benford(table$PRICE);
plot(x);

y <- getSuspects(x, table);
#hist(as.Date(y$DATE), breaks=1000);
hist(as.Date(unique(y$DATE)), breaks=314)

z <- y[grepl("2019", y$DATE),];
unique(z$DATE);

Some results:

General distribution of bitstamp's price digits:


General statistics of data:
Code:
Benford object:
 
Data: table$PRICE
Number of observations used = 34361833
Number of obs. for second order = 1636552
First digits analysed = 2

Mantissa:

   Statistic Value
        Mean  0.58
         Var  0.10
 Ex.Kurtosis -1.19
    Skewness -0.46


The 5 largest deviations:

  digits absolute.diff
1     10      820554.5
2     20      604793.2
3     19      575172.8
4     11      574876.8
5     18      561510.5

Stats:

Pearson's Chi-squared test

data:  table$PRICE
X-squared = 11178000, df = 89, p-value < 2.2e-16


Mantissa Arc Test

data:  table$PRICE
L2 = 0.090839, df = 2, p-value < 2.2e-16

Mean Absolute Deviation (MAD): 0.005221502
MAD Conformity - Nigrini (2012): Nonconformity
Distortion Factor: 21.44937

Time points where price digits do not follow Benford's law:


The corresponding time points for 2019 (note the date, when this started and when it ended!):
Code:
 [1] "2019-06-21" "2019-06-22" "2019-06-23" "2019-06-24" "2019-06-27"
 [6] "2019-06-28" "2019-06-30" "2019-07-01" "2019-07-02" "2019-07-03"
[11] "2019-07-05" "2019-07-06" "2019-07-11" "2019-07-13" "2019-07-14"
[16] "2019-07-15" "2019-07-16" "2019-07-18" "2019-07-19" "2019-07-20"
[21] "2019-07-21" "2019-07-22" "2019-07-23" "2019-07-25" "2019-07-27"
[26] "2019-07-31" "2019-08-01" "2019-08-02" "2019-08-03" "2019-08-04"
[31] "2019-08-05" "2019-08-13" "2019-08-14" "2019-08-15" "2019-08-16"
[36] "2019-08-17" "2019-08-18" "2019-08-19" "2019-08-20" "2019-08-21"
[41] "2019-08-22" "2019-08-23" "2019-08-24" "2019-08-25" "2019-08-26"
[46] "2019-08-27" "2019-08-28" "2019-09-02" "2019-09-03" "2019-09-04"
[51] "2019-09-05" "2019-09-06" "2019-09-07" "2019-09-08" "2019-09-09"
[56] "2019-09-10" "2019-09-11" "2019-09-12" "2019-09-13" "2019-09-14"
[61] "2019-09-15" "2019-09-16" "2019-09-17" "2019-09-18" "2019-09-19"
[66] "2019-09-20" "2019-09-21" "2019-09-22" "2019-09-23"

References: https://bitcointalk.org/index.php?topic=26136.msg52592024#msg52592024
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!