Modeling in R
In the following section, we will learn the implementation of the previously described models with the help of R.
Data selection
In Chapter 4, Big Data – Advanced Analytics, we will discuss in detail the aspects and methods of getting data from open sources and working with them efficiently. Here, we only present how the time series of stock prices and other relevant information can be acquired and used for the factor model's estimations.
We used the quantmod
package to collect the database.
Here is how it works in R:
library(quantmod) stocks <- stockSymbols()
As a result, we need to wait for a few seconds while data is fetched, and then we can see the output:
Fetching AMEX symbols... Fetching NASDAQ symbols... Fetching NYSE symbols... ...
Get Mastering R for Quantitative Finance now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.