https://github.com/OlgaBelitskaya/data-analyst-nd002/tree/master/Data_Analyst_ND_Project4
devtools, knitr, markdown, ggplot2, ggthemes, RColorBrewer, gridExtra, scales, reshape2, plyr, GGally, dplyr, tidyr, xlsx, lubridate, plotly, etc.
date dual_currency_basket EUR_978 USD_840 k_JPY JPY_392_100
1 2012-01-11 35.8717 40.7591 31.8729 100 41.4931
2 2012-01-12 35.6115 40.4061 31.6886 100 41.1968
3 2012-01-13 35.5527 40.2852 31.6807 100 41.1999
JPY_392 k_CNY CNY_156_k CNY_156 BRL_986 k_INR INR_356_k INR_356
1 0.414931 10 50.4805 5.04805 17.3884 100 60.9978 0.609978
2 0.411968 10 50.1576 5.01576 17.6077 100 61.3318 0.613318
3 0.411999 10 50.1467 5.01467 17.5711 100 61.1597 0.611597
gold silver platinum palladium foreign_exchange_reserves
1 1667.25 29.56 1495.09 648.66 453 952
2 1671.87 30.25 1512.93 653.06 453 952
3 1683.17 30.36 1527.84 652.90 453 952
monetary_gold
1 44 697
2 44 697
3 44 697
sum(row.with.na) = 0
'data.frame': 1128 obs. of 20 variables:
$ date : Date, format: "2012-01-11" "2012-01-12" ...
$ dual_currency_basket : num 35.9 35.6 35.6 35.6 35.7 ...
$ EUR_978 : num 40.8 40.4 40.3 40.6 40.4 ...
$ USD_840 : num 31.9 31.7 31.7 31.6 31.9 ...
$ k_JPY : num 100 100 100 100 100 100 100 100 100 100 ...
$ JPY_392_100 : num 41.5 41.2 41.2 41.2 41.6 ...
$ JPY_392 : num 0.415 0.412 0.412 0.412 0.416 ...
$ k_CNY : num 10 10 10 10 10 10 10 10 10 10 ...
$ CNY_156_k : num 50.5 50.2 50.1 50.1 50.6 ...
$ CNY_156 : num 5.05 5.02 5.01 5.01 5.06 ...
$ BRL_986 : num 17.4 17.6 17.6 17.8 17.9 ...
$ k_INR : num 100 100 100 100 100 100 100 100 100 100 ...
$ INR_356_k : num 61 61.3 61.2 61.5 62 ...
$ INR_356 : num 0.61 0.613 0.612 0.615 0.62 ...
$ gold : num 1667 1672 1683 1667 1687 ...
$ silver : num 29.6 30.2 30.4 31.1 30.4 ...
$ platinum : num 1495 1513 1528 1506 1529 ...
$ palladium : num 649 653 653 642 657 ...
$ foreign_exchange_reserves: Factor w/ 55 levels "307 718","308 895",..: 30 30 30 30 30 30 30 30 30 30 ...
$ monetary_gold : Factor w/ 54 levels "38 547","39 990",..: 12 12 12 12 12 12 12 12 12 12 ...
date dual_currency_basket EUR_978 USD_840
Min. :2012-01-11 Min. :33.30 Min. :38.41 Min. :28.95
1st Qu.:2013-02-25 1st Qu.:35.73 1st Qu.:40.63 1st Qu.:31.80
Median :2014-04-16 Median :40.59 Median :47.54 Median :35.02
Mean :2014-04-18 Mean :48.46 Mean :53.63 Mean :44.24
3rd Qu.:2015-06-11 3rd Qu.:65.05 3rd Qu.:69.02 3rd Qu.:61.51
Max. :2016-07-30 Max. :87.01 Max. :91.18 Max. :83.59
k_JPY JPY_392_100 JPY_392 k_CNY
Min. :100 Min. :30.38 Min. :0.3038 Min. : 1.000
1st Qu.:100 1st Qu.:33.96 1st Qu.:0.3396 1st Qu.:10.000
Median :100 Median :39.09 Median :0.3909 Median :10.000
Mean :100 Mean :42.49 Mean :0.4249 Mean : 7.941
3rd Qu.:100 3rd Qu.:51.04 3rd Qu.:0.5104 3rd Qu.:10.000
Max. :100 Max. :71.39 Max. :0.7139 Max. :10.000
CNY_156_k CNY_156 BRL_986 k_INR
Min. : 9.416 Min. : 4.585 Min. :13.54 Min. : 10.00
1st Qu.:46.638 1st Qu.: 5.089 1st Qu.:15.33 1st Qu.:100.00
Median :51.125 Median : 5.690 Median :16.04 Median :100.00
Mean :48.586 Mean : 7.027 Mean :16.71 Mean : 87.55
3rd Qu.:57.364 3rd Qu.: 9.658 3rd Qu.:17.92 3rd Qu.:100.00
Max. :99.987 Max. :12.705 Max. :26.68 Max. :100.00
INR_356_k INR_356 gold silver
Min. :10.00 Min. :0.4880 Min. :1255 Min. :19.57
1st Qu.:54.60 1st Qu.:0.5669 1st Qu.:1493 1st Qu.:23.16
Median :57.78 Median :0.5913 Median :1667 Median :28.71
Mean :58.93 Mean :0.7215 Mean :1862 Mean :28.49
3rd Qu.:66.39 3rd Qu.:0.9504 3rd Qu.:2263 3rd Qu.:32.27
Max. :99.99 Max. :1.2305 Max. :3168 Max. :43.38
platinum palladium foreign_exchange_reserves monetary_gold
Min. :1392 Min. : 575.1 313 342: 23 57 269 : 37
1st Qu.:1547 1st Qu.: 707.4 317 028: 23 42 630 : 23
Median :1643 Median : 904.6 322 375: 23 43 129 : 23
Mean :1764 Mean : 969.0 409 224: 23 45 016 : 23
3rd Qu.:1975 3rd Qu.:1235.7 431 958: 23 46 292 : 23
Max. :2747 Max. :1745.7 461 865: 23 47 680 : 23
(Other):990 (Other):976
Min. 1st Qu. Median Mean 3rd Qu. Max.
307700 327100 442800 409800 473400 486600
Min. 1st Qu. Median Mean 3rd Qu. Max.
38550 45020 47680 48120 50440 63500
'data.frame': 1128 obs. of 23 variables:
$ date : Date, format: "2012-01-11" "2012-01-12" ...
$ dual_currency_basket : num 35.9 35.6 35.6 35.6 35.7 ...
$ EUR_978 : num 40.8 40.4 40.3 40.6 40.4 ...
$ USD_840 : num 31.9 31.7 31.7 31.6 31.9 ...
$ k_JPY : num 100 100 100 100 100 100 100 100 100 100 ...
$ JPY_392_100 : num 41.5 41.2 41.2 41.2 41.6 ...
$ JPY_392 : num 0.415 0.412 0.412 0.412 0.416 ...
$ k_CNY : num 10 10 10 10 10 10 10 10 10 10 ...
$ CNY_156_k : num 50.5 50.2 50.1 50.1 50.6 ...
$ CNY_156 : num 5.05 5.02 5.01 5.01 5.06 ...
$ BRL_986 : num 17.4 17.6 17.6 17.8 17.9 ...
$ k_INR : num 100 100 100 100 100 100 100 100 100 100 ...
$ INR_356_k : num 61 61.3 61.2 61.5 62 ...
$ INR_356 : num 0.61 0.613 0.612 0.615 0.62 ...
$ gold : num 1667 1672 1683 1667 1687 ...
$ silver : num 29.6 30.2 30.4 31.1 30.4 ...
$ platinum : num 1495 1513 1528 1506 1529 ...
$ palladium : num 649 653 653 642 657 ...
$ foreign_exchange_reserves: num 453952 453952 453952 453952 453952 ...
$ monetary_gold : num 44697 44697 44697 44697 44697 ...
$ day : num 11 12 13 14 17 18 19 20 21 24 ...
$ month : chr "January" "January" "January" "January" ...
$ year : num 2012 2012 2012 2012 2012 ...
'data.frame': 1128 obs. of 13 variables:
$ dual_currency_basket : num 35.9 35.6 35.6 35.6 35.7 ...
$ EUR_978 : num 40.8 40.4 40.3 40.6 40.4 ...
$ USD_840 : num 31.9 31.7 31.7 31.6 31.9 ...
$ JPY_392 : num 0.415 0.412 0.412 0.412 0.416 ...
$ CNY_156 : num 5.05 5.02 5.01 5.01 5.06 ...
$ BRL_986 : num 17.4 17.6 17.6 17.8 17.9 ...
$ INR_356 : num 0.61 0.613 0.612 0.615 0.62 ...
$ gold : num 1667 1672 1683 1667 1687 ...
$ silver : num 29.6 30.2 30.4 31.1 30.4 ...
$ platinum : num 1495 1513 1528 1506 1529 ...
$ palladium : num 649 653 653 642 657 ...
$ foreign_exchange_reserves: num 453952 453952 453952 453952 453952 ...
$ monetary_gold : num 44697 44697 44697 44697 44697 ...
http://stackoverflow.com/questions/24954912/sharing-a-legend-between-two-combined-ggplots
Pearson's product-moment correlation
data: dual_currency_basket and gold
t = 86.302, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9239207 0.9392967
sample estimates:
cor
0.9320269
Pearson's product-moment correlation
data: dual_currency_basket and silver
t = 23.544, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.5338973 0.6122110
sample estimates:
cor
0.5743669
Pearson's product-moment correlation
data: dual_currency_basket and platinum
t = 70.021, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.8902876 0.9121507
sample estimates:
cor
0.9017946
Pearson's product-moment correlation
data: dual_currency_basket and palladium
t = 64.112, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.8727475 0.8979171
sample estimates:
cor
0.8859831
Pearson's product-moment correlation
data: dual_currency_basket and JPY_392
t = 85.698, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9229565 0.9385212
sample estimates:
cor
0.9311618
Pearson's product-moment correlation
data: dual_currency_basket and CNY_156
t = 412.21, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9962950 0.9970661
sample estimates:
cor
0.996703
Pearson's product-moment correlation
data: dual_currency_basket and INR_356
t = 182.94, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9815756 0.9853877
sample estimates:
cor
0.9835911
Pearson's product-moment correlation
data: JPY_392 and CNY_156
t = 77.832, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9086244 0.9269746
sample estimates:
cor
0.9182913
Pearson's product-moment correlation
data: JPY_392 and INR_356
t = 96.989, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9384341 0.9509517
sample estimates:
cor
0.9450382
Pearson's product-moment correlation
data: INR_356 and CNY_156
t = 202.67, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.9849159 0.9880411
sample estimates:
cor
0.9865685
Pearson's product-moment correlation
data: foreign_exchange_reserves and monetary_gold
t = -14.395, df = 1126, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.4424186 -0.3437725
sample estimates:
cor
-0.3942305
##
## Calls:
## m1: lm(formula = gold ~ dual_currency_basket, data = centrobank)
## m2: lm(formula = gold ~ dual_currency_basket + platinum, data = centrobank)
## m3: lm(formula = gold ~ dual_currency_basket + platinum + palladium,
## data = centrobank)
## m4: lm(formula = gold ~ dual_currency_basket + platinum + palladium +
## silver, data = centrobank)
##
## ===========================================================================
## m1 m2 m3 m4
## ---------------------------------------------------------------------------
## (Intercept) 422.931*** -134.441*** -588.201*** -407.192***
## (17.455) (36.930) (27.267) (13.677)
## dual_currency_basket 29.692*** 18.975*** 25.786*** 21.744***
## (0.344) (0.713) (0.506) (0.257)
## platinum 0.611*** 1.247*** 0.215***
## (0.037) (0.030) (0.023)
## palladium -1.031*** -0.155***
## (0.027) (0.020)
## silver 34.608***
## (0.579)
## ---------------------------------------------------------------------------
## R-squared 0.9 0.9 1.0 1.0
## adj. R-squared 0.9 0.9 1.0 1.0
## sigma 173.5 155.4 103.1 50.4
## F 7448.1 4777.6 7718.9 25087.7
## p 0.0 0.0 0.0 0.0
## Log-likelihood -7415.4 -7291.1 -6827.3 -6020.2
## Deviance 33877079.8 27172697.1 11941503.5 2854836.1
## AIC 14836.9 14590.1 13664.7 12052.5
## BIC 14851.9 14610.2 13689.8 12082.7
## N 1128 1128 1128 1128
## ===========================================================================