#reading the file
BTC <- read.csv(paste("bitcoin_dataset.csv", sep=" "))
#geting the summary 
library(psych)
summary(BTC)
##                   Date      btc_market_price   btc_total_bitcoins
##  2009-11-10 00:00:00:   1   Min.   :   0.000   Min.   : 1339450  
##  2009-11-11 00:00:00:   1   1st Qu.:   5.177   1st Qu.: 7634838  
##  2009-11-12 00:00:00:   1   Median : 213.115   Median :11965900  
##  2009-11-13 00:00:00:   1   Mean   : 471.826   Mean   :10976895  
##  2009-11-14 00:00:00:   1   3rd Qu.: 546.285   3rd Qu.:14816719  
##  2009-11-15 00:00:00:   1   Max.   :7437.543   Max.   :16669275  
##  (Other)            :2914                                        
##  btc_market_cap      btc_trade_volume    btc_blocks_size   
##  Min.   :0.000e+00   Min.   :0.000e+00   Min.   :     0.0  
##  1st Qu.:4.556e+07   1st Qu.:2.226e+05   1st Qu.:   526.5  
##  Median :2.910e+09   Median :7.884e+06   Median : 11733.0  
##  Mean   :7.290e+09   Mean   :3.161e+07   Mean   : 30700.7  
##  3rd Qu.:7.179e+09   3rd Qu.:2.444e+07   3rd Qu.: 48666.2  
##  Max.   :1.239e+11   Max.   :1.267e+09   Max.   :140294.6  
##                      NA's   :21                            
##  btc_avg_block_size  btc_n_orphaned_blocks btc_n_transactions_per_block
##  Min.   :0.0002152   Min.   :0.0000        Min.   :   1.0              
##  1st Qu.:0.0204443   1st Qu.:0.0000        1st Qu.:  46.0              
##  Median :0.1750999   Median :0.0000        Median : 348.0              
##  Mean   :0.3180708   Mean   :0.3623        Mean   : 609.3              
##  3rd Qu.:0.5971502   3rd Qu.:0.0000        3rd Qu.:1042.5              
##  Max.   :1.0466060   Max.   :7.0000        Max.   :2436.1              
##                                                                        
##  btc_median_confirmation_time btc_hash_rate      btc_difficulty     
##  Min.   : 0.000               Min.   :       0   Min.   :1.000e+00  
##  1st Qu.: 0.000               1st Qu.:      10   1st Qu.:1.468e+06  
##  Median : 7.767               Median :    4127   Median :5.109e+08  
##  Mean   : 7.130               Mean   :  828840   Mean   :1.099e+11  
##  3rd Qu.: 9.852               3rd Qu.:  490384   3rd Qu.:6.225e+10  
##  Max.   :47.733               Max.   :12999790   Max.   :1.453e+12  
##                                                                     
##  btc_miners_revenue btc_transaction_fees btc_cost_per_transaction_percent
##  Min.   :       0   Min.   :  0.000      Min.   :      0.0               
##  1st Qu.:   39709   1st Qu.:  6.253      1st Qu.:      1.2               
##  Median :  769083   Median : 17.546      Median :      2.6               
##  Mean   : 1280992   Mean   : 45.727      Mean   :   1918.6               
##  3rd Qu.: 1687000   3rd Qu.: 44.974      3rd Qu.:      6.4               
##  Max.   :15347363   Max.   :668.132      Max.   :2000000.0               
##                                                                          
##  btc_cost_per_transaction btc_n_unique_addresses btc_n_transactions
##  Min.   : 0.000           Min.   :    49         Min.   :    49    
##  1st Qu.: 3.408           1st Qu.: 12042         1st Qu.:  6713    
##  Median : 7.459           Median : 95554         Median : 58183    
##  Mean   :11.680           Mean   :171251         Mean   : 92272    
##  3rd Qu.:12.451           3rd Qu.:302227         3rd Qu.:159053    
##  Max.   :90.202           Max.   :733878         Max.   :369098    
##                                                                    
##  btc_n_transactions_total btc_n_transactions_excluding_popular
##  Min.   :    26958        Min.   :    49                      
##  1st Qu.:  1834960        1st Qu.:  5642                      
##  Median : 26725555        Median : 42653                      
##  Mean   : 59858433        Mean   : 85010                      
##  3rd Qu.: 91651828        3rd Qu.:154779                      
##  Max.   :269460981        Max.   :361974                      
##                                                               
##  btc_n_transactions_excluding_chains_longer_than_100 btc_output_volume 
##  Min.   :    49                                      Min.   :    2450  
##  1st Qu.:  6034                                      1st Qu.:  431346  
##  Median : 30921                                      Median : 1025858  
##  Mean   : 56864                                      Mean   : 1486692  
##  3rd Qu.: 94479                                      3rd Qu.: 1938697  
##  Max.   :286896                                      Max.   :45992223  
##                                                                        
##  btc_estimated_transaction_volume btc_estimated_transaction_volume_usd
##  Min.   :      0                  Min.   :0.000e+00                   
##  1st Qu.:  83286                  1st Qu.:6.869e+05                   
##  Median : 170951                  Median :3.070e+07                   
##  Mean   : 195545                  Mean   :1.124e+08                   
##  3rd Qu.: 254403                  3rd Qu.:1.097e+08                   
##  Max.   :5825066                  Max.   :2.396e+09                   
## 
str(BTC)
## 'data.frame':    2920 obs. of  24 variables:
##  $ Date                                               : Factor w/ 2920 levels "2009-11-10 00:00:00",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ btc_market_price                                   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_total_bitcoins                                 : num  1339450 1342900 1346400 1349900 1354050 ...
##  $ btc_market_cap                                     : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_trade_volume                                   : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_blocks_size                                    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_avg_block_size                                 : num  0.000215 0.000323 0.000215 0.000242 0.000216 ...
##  $ btc_n_orphaned_blocks                              : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_n_transactions_per_block                       : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ btc_median_confirmation_time                       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_hash_rate                                      : num  3.53e-06 3.43e-06 3.48e-06 3.48e-06 4.13e-06 ...
##  $ btc_difficulty                                     : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ btc_miners_revenue                                 : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_transaction_fees                               : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_cost_per_transaction_percent                   : num  0 19.2 0 673.1 0 ...
##  $ btc_cost_per_transaction                           : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ btc_n_unique_addresses                             : num  71 71 70 73 83 96 100 91 79 73 ...
##  $ btc_n_transactions                                 : num  71 78 70 73 83 96 100 91 79 73 ...
##  $ btc_n_transactions_total                           : num  26958 27036 27106 27179 27262 ...
##  $ btc_n_transactions_excluding_popular               : num  71 78 70 73 83 96 100 91 79 73 ...
##  $ btc_n_transactions_excluding_chains_longer_than_100: num  71 78 70 73 83 96 100 91 79 73 ...
##  $ btc_output_volume                                  : num  3550 93450 3500 4100 4150 ...
##  $ btc_estimated_transaction_volume                   : num  0 18000 0 520 0 0 0 0 0 0 ...
##  $ btc_estimated_transaction_volume_usd               : num  0 0 0 0 0 0 0 0 0 0 ...
describe(BTC)
##                                                     vars    n         mean
## Date*                                                  1 2920 1.460500e+03
## btc_market_price                                       2 2920 4.718300e+02
## btc_total_bitcoins                                     3 2920 1.097689e+07
## btc_market_cap                                         4 2920 7.290293e+09
## btc_trade_volume                                       5 2899 3.161043e+07
## btc_blocks_size                                        6 2920 3.070073e+04
## btc_avg_block_size                                     7 2920 3.200000e-01
## btc_n_orphaned_blocks                                  8 2920 3.600000e-01
## btc_n_transactions_per_block                           9 2920 6.093000e+02
## btc_median_confirmation_time                          10 2920 7.130000e+00
## btc_hash_rate                                         11 2920 8.288403e+05
## btc_difficulty                                        12 2920 1.099002e+11
## btc_miners_revenue                                    13 2920 1.280992e+06
## btc_transaction_fees                                  14 2920 4.573000e+01
## btc_cost_per_transaction_percent                      15 2920 1.918640e+03
## btc_cost_per_transaction                              16 2920 1.168000e+01
## btc_n_unique_addresses                                17 2920 1.712510e+05
## btc_n_transactions                                    18 2920 9.227195e+04
## btc_n_transactions_total                              19 2920 5.985843e+07
## btc_n_transactions_excluding_popular                  20 2920 8.501016e+04
## btc_n_transactions_excluding_chains_longer_than_100   21 2920 5.686395e+04
## btc_output_volume                                     22 2920 1.486692e+06
## btc_estimated_transaction_volume                      23 2920 1.955447e+05
## btc_estimated_transaction_volume_usd                  24 2920 1.123620e+08
##                                                               sd
## Date*                                               8.430800e+02
## btc_market_price                                    9.349600e+02
## btc_total_bitcoins                                  4.456721e+06
## btc_market_cap                                      1.548875e+10
## btc_trade_volume                                    8.273604e+07
## btc_blocks_size                                     3.926642e+04
## btc_avg_block_size                                  3.400000e-01
## btc_n_orphaned_blocks                               8.400000e-01
## btc_n_transactions_per_block                        6.533900e+02
## btc_median_confirmation_time                        5.050000e+00
## btc_hash_rate                                       1.799654e+06
## btc_difficulty                                      2.364067e+11
## btc_miners_revenue                                  1.999356e+06
## btc_transaction_fees                                7.885000e+01
## btc_cost_per_transaction_percent                    5.128409e+04
## btc_cost_per_transaction                            1.342000e+01
## btc_n_unique_addresses                              1.865764e+05
## btc_n_transactions                                  9.739535e+04
## btc_n_transactions_total                            7.459717e+07
## btc_n_transactions_excluding_popular                9.778191e+04
## btc_n_transactions_excluding_chains_longer_than_100 6.551870e+04
## btc_output_volume                                   2.280472e+06
## btc_estimated_transaction_volume                    2.697794e+05
## btc_estimated_transaction_volume_usd                2.402841e+08
##                                                           median
## Date*                                               1.460500e+03
## btc_market_price                                    2.131200e+02
## btc_total_bitcoins                                  1.196590e+07
## btc_market_cap                                      2.909919e+09
## btc_trade_volume                                    7.884278e+06
## btc_blocks_size                                     1.173300e+04
## btc_avg_block_size                                  1.800000e-01
## btc_n_orphaned_blocks                               0.000000e+00
## btc_n_transactions_per_block                        3.480000e+02
## btc_median_confirmation_time                        7.770000e+00
## btc_hash_rate                                       4.127250e+03
## btc_difficulty                                      5.109297e+08
## btc_miners_revenue                                  7.690828e+05
## btc_transaction_fees                                1.755000e+01
## btc_cost_per_transaction_percent                    2.620000e+00
## btc_cost_per_transaction                            7.460000e+00
## btc_n_unique_addresses                              9.555400e+04
## btc_n_transactions                                  5.818250e+04
## btc_n_transactions_total                            2.672556e+07
## btc_n_transactions_excluding_popular                4.265250e+04
## btc_n_transactions_excluding_chains_longer_than_100 3.092050e+04
## btc_output_volume                                   1.025858e+06
## btc_estimated_transaction_volume                    1.709510e+05
## btc_estimated_transaction_volume_usd                3.070331e+07
##                                                          trimmed
## Date*                                               1.460500e+03
## btc_market_price                                    2.521800e+02
## btc_total_bitcoins                                  1.136309e+07
## btc_market_cap                                      3.550474e+09
## btc_trade_volume                                    1.269097e+07
## btc_blocks_size                                     2.340318e+04
## btc_avg_block_size                                  2.800000e-01
## btc_n_orphaned_blocks                               1.300000e-01
## btc_n_transactions_per_block                        5.175500e+02
## btc_median_confirmation_time                        6.920000e+00
## btc_hash_rate                                       3.448951e+05
## btc_difficulty                                      4.612941e+10
## btc_miners_revenue                                  8.476209e+05
## btc_transaction_fees                                2.621000e+01
## btc_cost_per_transaction_percent                    4.700000e+00
## btc_cost_per_transaction                            8.980000e+00
## btc_n_unique_addresses                              1.451639e+05
## btc_n_transactions                                  7.884295e+04
## btc_n_transactions_total                            4.602158e+07
## btc_n_transactions_excluding_popular                7.055401e+04
## btc_n_transactions_excluding_chains_longer_than_100 4.604016e+04
## btc_output_volume                                   1.152241e+06
## btc_estimated_transaction_volume                    1.702264e+05
## btc_estimated_transaction_volume_usd                5.309453e+07
##                                                              mad     min
## Date*                                               1.082300e+03       1
## btc_market_price                                    3.126000e+02       0
## btc_total_bitcoins                                  4.991562e+06 1339450
## btc_market_cap                                      4.306411e+09       0
## btc_trade_volume                                    1.168391e+07       0
## btc_blocks_size                                     1.739386e+04       0
## btc_avg_block_size                                  2.600000e-01       0
## btc_n_orphaned_blocks                               0.000000e+00       0
## btc_n_transactions_per_block                        4.981500e+02       1
## btc_median_confirmation_time                        3.360000e+00       0
## btc_hash_rate                                       6.119060e+03       0
## btc_difficulty                                      7.575044e+08       1
## btc_miners_revenue                                  1.095266e+06       0
## btc_transaction_fees                                2.287000e+01       0
## btc_cost_per_transaction_percent                    2.520000e+00       0
## btc_cost_per_transaction                            6.460000e+00       0
## btc_n_unique_addresses                              1.401020e+05      49
## btc_n_transactions                                  7.874311e+04      49
## btc_n_transactions_total                            3.932131e+07   26958
## btc_n_transactions_excluding_popular                6.129143e+04      49
## btc_n_transactions_excluding_chains_longer_than_100 3.965288e+04      49
## btc_output_volume                                   1.054362e+06    2450
## btc_estimated_transaction_volume                    1.271492e+05       0
## btc_estimated_transaction_volume_usd                4.549469e+07       0
##                                                              max
## Date*                                               2.920000e+03
## btc_market_price                                    7.437540e+03
## btc_total_bitcoins                                  1.666928e+07
## btc_market_cap                                      1.239385e+11
## btc_trade_volume                                    1.267435e+09
## btc_blocks_size                                     1.402946e+05
## btc_avg_block_size                                  1.050000e+00
## btc_n_orphaned_blocks                               7.000000e+00
## btc_n_transactions_per_block                        2.436070e+03
## btc_median_confirmation_time                        4.773000e+01
## btc_hash_rate                                       1.299979e+07
## btc_difficulty                                      1.452840e+12
## btc_miners_revenue                                  1.534736e+07
## btc_transaction_fees                                6.681300e+02
## btc_cost_per_transaction_percent                    2.000000e+06
## btc_cost_per_transaction                            9.020000e+01
## btc_n_unique_addresses                              7.338780e+05
## btc_n_transactions                                  3.690980e+05
## btc_n_transactions_total                            2.694610e+08
## btc_n_transactions_excluding_popular                3.619740e+05
## btc_n_transactions_excluding_chains_longer_than_100 2.868960e+05
## btc_output_volume                                   4.599222e+07
## btc_estimated_transaction_volume                    5.825066e+06
## btc_estimated_transaction_volume_usd                2.396482e+09
##                                                            range  skew
## Date*                                               2.919000e+03  0.00
## btc_market_price                                    7.437540e+03  3.88
## btc_total_bitcoins                                  1.532983e+07 -0.59
## btc_market_cap                                      1.239385e+11  4.00
## btc_trade_volume                                    1.267435e+09  6.07
## btc_blocks_size                                     1.402946e+05  1.28
## btc_avg_block_size                                  1.050000e+00  0.81
## btc_n_orphaned_blocks                               7.000000e+00  2.80
## btc_n_transactions_per_block                        2.435070e+03  0.97
## btc_median_confirmation_time                        4.773000e+01  0.25
## btc_hash_rate                                       1.299979e+07  3.08
## btc_difficulty                                      1.452840e+12  3.01
## btc_miners_revenue                                  1.534736e+07  3.22
## btc_transaction_fees                                6.681300e+02  3.38
## btc_cost_per_transaction_percent                    2.000000e+06 32.38
## btc_cost_per_transaction                            9.020000e+01  2.08
## btc_n_unique_addresses                              7.338290e+05  0.92
## btc_n_transactions                                  3.690490e+05  0.96
## btc_n_transactions_total                            2.694340e+08  1.29
## btc_n_transactions_excluding_popular                3.619250e+05  1.01
## btc_n_transactions_excluding_chains_longer_than_100 2.868470e+05  1.19
## btc_output_volume                                   4.598977e+07  8.62
## btc_estimated_transaction_volume                    5.825066e+06 11.37
## btc_estimated_transaction_volume_usd                2.396482e+09  4.08
##                                                     kurtosis           se
## Date*                                                  -1.20 1.560000e+01
## btc_market_price                                       17.21 1.730000e+01
## btc_total_bitcoins                                     -0.83 8.247531e+04
## btc_market_cap                                         18.01 2.866323e+08
## btc_trade_volume                                       52.39 1.536635e+06
## btc_blocks_size                                         0.43 7.266600e+02
## btc_avg_block_size                                     -0.82 1.000000e-02
## btc_n_orphaned_blocks                                   8.70 2.000000e-02
## btc_n_transactions_per_block                           -0.39 1.209000e+01
## btc_median_confirmation_time                            1.25 9.000000e-02
## btc_hash_rate                                          10.22 3.330409e+04
## btc_difficulty                                          9.60 4.374902e+09
## btc_miners_revenue                                     13.10 3.699973e+04
## btc_transaction_fees                                   13.35 1.460000e+00
## btc_cost_per_transaction_percent                     1120.49 9.490500e+02
## btc_cost_per_transaction                                4.53 2.500000e-01
## btc_n_unique_addresses                                 -0.42 3.452750e+03
## btc_n_transactions                                     -0.35 1.802380e+03
## btc_n_transactions_total                                0.50 1.380483e+06
## btc_n_transactions_excluding_popular                   -0.36 1.809540e+03
## btc_n_transactions_excluding_chains_longer_than_100     0.21 1.212480e+03
## btc_output_volume                                     117.99 4.220202e+04
## btc_estimated_transaction_volume                      180.14 4.992490e+03
## btc_estimated_transaction_volume_usd                   20.83 4.446656e+06
BTC<-na.omit(BTC)
library(corrplot)
## corrplot 0.84 loaded
cor <- cor(BTC[,2:12])
#corrplot
corrplot(cor, method = "pie")

#Bitcoin date vs market price
plot(BTC$Date, BTC$btc_market_price)

#Bitcoin market price vs market cap
mod<-lm(btc_market_price~btc_market_cap, data=BTC)
mod1<-lm(btc_market_price~btc_estimated_transaction_volume_usd, data=BTC)
summary(mod)
## 
## Call:
## lm(formula = btc_market_price ~ btc_market_cap, data = BTC)
## 
## Residuals:
##      Min       1Q   Median       3Q      Max 
## -105.646  -29.737   -8.419    3.797  280.916 
## 
## Coefficients:
##                 Estimate Std. Error t value Pr(>|t|)    
## (Intercept)    3.208e+01  9.563e-01   33.55   <2e-16 ***
## btc_market_cap 6.029e-08  5.569e-11 1082.63   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 46.59 on 2897 degrees of freedom
## Multiple R-squared:  0.9975, Adjusted R-squared:  0.9975 
## F-statistic: 1.172e+06 on 1 and 2897 DF,  p-value: < 2.2e-16
summary(mod1)
## 
## Call:
## lm(formula = btc_market_price ~ btc_estimated_transaction_volume_usd, 
##     data = BTC)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -3630.5   -63.4   -59.9    20.9  3372.0 
## 
## Coefficients:
##                                       Estimate Std. Error t value Pr(>|t|)
## (Intercept)                          6.336e+01  6.940e+00   9.131   <2e-16
## btc_estimated_transaction_volume_usd 3.629e-06  2.607e-08 139.193   <2e-16
##                                         
## (Intercept)                          ***
## btc_estimated_transaction_volume_usd ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 338.4 on 2897 degrees of freedom
## Multiple R-squared:  0.8699, Adjusted R-squared:  0.8699 
## F-statistic: 1.937e+04 on 1 and 2897 DF,  p-value: < 2.2e-16
plot(BTC$btc_market_price,BTC$btc_market_cap)

plot(BTC$btc_market_price,BTC$btc_estimated_transaction_volume_usd)