Introduction
This chapter will walk you through a financial analysis project where you will analyze stock market data, determine whether stocks are over or under-valued, use this information to identify a list of target stocks that may make good investments, and visually analyze the price histories of the target stocks.
We must caution that the goal of this chapter is not to make you an expert in stock market analysis or to make you rich. Quants on Wall Street study engineering models that perform significantly more sophisticated operations than those we will touch upon here. Entire books have been written on stock market models and financial engineering, but we only have a single chapter to dedicate to this topic. So given the time and format constraints, the goals of this chapter will be:
- To get a basic understanding of the data that we will work with
- To find useful and interesting ways to analyze and model this data
- To learn how to leverage data science tools and techniques to perform the types of analytical tasks that we need to perform on the data
The data we will use for this chapter consists of current data for stocks tracked by the website finviz.com and daily histories of stock prices obtained from Yahoo! Finance.
As in previous chapters, the tool we will rely on for this project will be the R statistical programming language. As you've probably noticed by now, R has strong packages available that can assist us in the needed analytical tasks; we will be leveraging some of these packages in this chapter. Additionally, the recipes in this chapter will roughly follow the data science pipeline, which we will adapt to the type of data we are working with and the types of analysis we would like to conduct on the data.