In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use 4.1 Categorical vs. Categorical from Data Visualization with R.

Q1 Calculate mean yearly returns for each stock.

Hint: See the code in 4.3.1 Bar chart (on summary statistics).

Q2 Plot mean yearly returns using bar charts.

Hint: See the code in 4.3.1 Bar chart (on summary statistics).

Q3 Label the bars with mean yearly returns.

Hint: See the code in 4.3.1 Bar chart (on summary statistics).

Q4 Plot the distribution of yearly returns by stock using kernel density plots.

Hint: See the code in 4.3.2 Grouped kernel density plots.

Q5 Which of the three stocks has highest chance of losing big when things go wrong? Discuss your reason.

Hint: Google how to interpret density plots. IBM has the greatest risk of losing big when things go wrong because it has less consistent density than the other stocks. Niether Apple or Microsoft have a density as high as IBM but their stocks dont drop as much and as rapidly as IBM does so their safer. ## Q6 Plot the distribution of yearly returns by stock using boxplots. Hint: See the code in 4.3.3 Box plots.

Q7 If you were a risk-loving investor (defined as one chasing after the greatest returns even at the risk of losing big), which of the three stocks would you choose? Discuss your reason.

If I were a risk loving investor I would choose Apple. This is because it has the highest outliers, meaning that if I got very lucky its possible I could get those high returns. With IBM or Microsoft they didnt have outliers nearly this big meaning that their possible returns never got that high.

Q8 Hide the messages, but display the code and their results from the webpage.

Hint: Use message, echo and results in the global chunk options. Refer to the RMarkdown Reference Guide.

Q9 Display the title and your name correctly at the top of the webpage.

Q10 Use the correct slug.