Question: Use R language code and English interpretation to answer all questions: Clustering Stock Returns When building portfolios of stocks, investors seek to obtain good returns
Use R language code and English interpretation to answer all questions: Clustering Stock Returns
When building portfolios of stocks, investors seek to obtain good returns while limiting the variability in those returns over time. This can be achieved by selecting stocks that show different patterns of returns. In this question, we will use clustering to identify clusters of stocks that have similar returns over time; an investor would select a diverse portfolio by selecting stocks from different clusters.
For this question, we will use the dataset NasdaqReturns.csv which contains monthly stock returns from the NASDAQ stock exchange during The companies selected in this dataset are limited to those that were listed on the stock exchange for this entire time period and whose stock price never fell below $ The NASDAQ is the secondlargest stock exchange in the world, and it lists many technology companies. The variables in the dataset are described in Table
Table : Variables in the dataset NasdaqReturns.csv
Variable: StockSymbol Industry SubIndustry Ret Ret
Let us start by exploring the dataset.
a How many companies are there in this dataset? points How many companies are there in each of the industries? points
b In the aftermath of the dotcom bubble bursting in the early s the NASDAQ was quite tumultuous. In December how many stocks in this dataset saw their value increase by including or more? points Decrease by including or more? points
c Entering the Great Recession, most stocks lost significant value, but some sectors were hit harder than others. In October which industries had the worst average return? points
Let us now cluster the stocks according to the monthly returns. For the remainder of this question, make sure that you are just clustering the observations based on the variables RetRetie StockSymbol, Industry, and SubIndustry should not be used to cluster the observations points
Hint: You can do this by creating a new data frame without irrelevant variables using the function within we learned in the lecture Model selection
a In this analysis, we will not normalize our data prior to clustering. Why is this a valid approach for this question and dataset? points
b Cluster the data using Hierarchical clustering. points Clearly indicate which distance metrics you used for point distances and cluster distances. points Plot the resulting dendrogram. points What do you think are reasonable choices for the number of clusters to select, based on the dendrogram? points A further consideration for the stock selection problem is that we should include enough stocks to create our welldiversified portfolio. Based on the dendrogram and this specific concern, select a number of clusters to use for the rest of the question, and justify your choice. points
c Extract cluster assignments from your hierarchical clustering model, using the number of clusters you selected in b points Describe each cluster, using the number of observations in the cluster points the most common industry of the companies in the cluster points and the most common subindustry of the companies in the cluster points
Hint: Since we never changed the order of the observations, you can create a data frame including the number of observations in each industrysubindustry that is counted by the function tablerecall what you learned in the rd tutorial You can then use the order function to sort this data frame in the order of frequency.
d For some months, we expect there to be significant differences between the returns of stocks in different clusters. For February do some clusters have negative average returns while other clusters have positive average returns? points How about for March points
e Now run the Kmeans clustering algorithm on this data when clustering, only use the variables Ret Ret You should select the same number of clusters that you used for Hierarchical clustering. points Extract cluster assignments from your Kmeans clustering model, and compare them to the Hierarchical cluster assignments by common industries. points Openended question: Are there any similar clusters? point
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
