3. What is R
• R is one of the most popular platforms for data analysis
and visualization currently available.
dsjerry2017@gmail.com
4. Some news about R
http://spectrum.ieee.org/computing/software/the-2016-top-programming-languages
dsjerry2017@gmail.com
5. A brief history of R
Time Topic
1993 Research project in Auckland, NewZealand
Ross Ihaka and Robert Gentlemen
1995 Released as open-source software
Generally compatible with the ‘S’ language
1997 R core group formed
2000 R 1.0.0 released
2004 First international user conference in Vienna
2012 R 2.15.2 released
2013 R 3.0.2 released
The CRAN package repository features 5,026 available packages.
2017 R 3.4.1 released
The CRAN package repository features 10,875available packages.dsjerry2017@gmail.com
7. Why “R”? Not “SAS”? Or others?
• 2009
• R (lingua franca)
• Google, Microsoft, Facebook, Johnson & Johnson,Pfizer, Merck, BOA,
InterContinental Hotels and Shell…, including New York Times now use it !
•
•
•
• To give researchers of all stripes an accessible data
analysis tool.
• 10,875 (2017)
dsjerry2017@gmail.com
18. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
32. Fun Time –
What’s incorrect about subsetting
• Tsmc and foxconn columns
A. M_tsmc_foxconn[,c(“tsmc”, “foxconn”)]
B. M_tsmc_foxconn[c(“tsmc”, “foxconn”)]
C. M_tsmc_foxconn[,]
dsjerry2017@gmail.com
33. Cor()relation
• +1 perfect positive linear relationship
• -1 perfect negative linear relationship
• 0 no linear relationship
Chapter2_vectors_and_matrices.R
dsjerry2017@gmail.com
54. Data Input and output
Chapter6_io.R
dsjerry2017@gmail.com
55. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
71. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
75. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
87. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
88. MA Model Estimation and Forecasting
• ARIMA Autoregressive
Integrated Moving Average model,
)
• ARIMA p d q
• p
• d TS
• q
• ARIMA ACF
PACF p,d,q
• ACF(Sample Autocorrelation Function,
)
• PACF (Sample Partial Autocorrelation
Function, )
ACF
PACF
Chapter8_QA.R
dsjerry2017@gmail.com
89. MA Model Estimation and Forecasting
Lag=1
Lag=3
arima(x, order = c(0,0,1))
arima(x, order = c(3,0,1))
AIC( )
(Goodness of Fit)
AICChapter8_QA.R
dsjerry2017@gmail.com
90. MA Model Estimation and
Forecasting(Non-Auto ARIMA)
Chapter8_QA.R
dsjerry2017@gmail.com
91. MA Model Estimation and
Forecasting(Non-Auto ARIMA)
Chapter8_QA.R
dsjerry2017@gmail.com
92. MA Model Estimation and
Forecasting(Auto ARIMA)
Chapter8_QA.R
dsjerry2017@gmail.com
94. Outline
• The Basics
• Vectors and Matrices, Data Frames, Factors, Lists
• Exploratory time series data analysis
• Stock Trading
• Quantitative Analysis
• Correlation analysis
• MA Model Estimation and Forecasting
• Querying the Bitcoin blockchain with R
dsjerry2017@gmail.com
97. Blockchain
Blockchain is a distributed database that is used to maintain a
continuously growing list of records, called blocks. Each block contains
a timestamp and a link to a previous block.
A blockchain is typically managed by a peer-to-peer network collectively
adhering to a protocol for validating new blocks.
https://medium.com/@micheledaliessi/how-does-the-blockchain-work-98c8cd01d2ae
dsjerry2017@gmail.com
98. Querying the Bitcoin blockchain with R
Chapter9_Blockchain.R
dsjerry2017@gmail.com
99. Querying the Bitcoin blockchain with R
Chapter9_Blockchain.R
dsjerry2017@gmail.com
100. Conclusion
• Concept of R basic
• Exploratory time series data
• Learn stock trading with R
• Quantitative analysis with forecasting
• Querying the Bitcoin Blockchain Visualization with R
dsjerry2017@gmail.com