Answered step by step
Verified Expert Solution
Question
1 Approved Answer
pls take screenshot with R code, thanks Use the stocks dataset with the weekly closing values for the year 2021 initialized as shown below:stocks Use
pls take screenshot with R code, thanks
Use the stocks dataset with the weekly closing values for the year 2021 initialized as shown below:stocks
Use the stocks dataset with the weekly closing values for the year 2021 initialized as shown below: stocks head(stocks) Date MSFT AAPL GOOG FB AMZN TSLA 1 2021-01-01 216 130 1787 269 3162 816 2 2021-01-08 211 128 1740 246 3127 845 3 2021-01-15 223 136 1891 273 3307 845 4 2021-01-22 237 136 1863 265 3238 835 5 2021-01-29 240 137 2062 266 3331 850 6 2021-02-05 242 134 2096 270 3262 812 a) Show the pair wise plots for all the 6 stocks in the dataset in a single plot. b) Show the correlation matrix for the 6 stocks in the dataset rounded to 2 decimals. c) Provide at least 4 interpretations of the results d) Store the correlation matrix from b) in the variable cm. Using loops, for each stock in the dataset, show the top 3 correlated stocks for that respective stock. The code should work for any dataset with any number of stocks. Sample output for the given dataset is shown below: Top 3 for Stock MSFT GOOG AAPL TSLA 0.95 0.90 0.71 Top 3 for Stock AAPL MSFT GOOG TSLA 0.90 0. 79 0.73 Top 3 for Stock GOOG MSFT FB AAPL 0. 95 0.85 0.79 Top 3 for Stock FB GOOG MSFT AMZN 0.85 0.68 0.66 Top 3 for Stock AMZN GOOG FB MSFT 0. 67 0. 66 0.64 Top 3 for Stock TSLA AAPL MSFT GOOG 0. 73 0.71 0.47
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started