# Cleaning Entire Data Set
stock_clean <- stock %>%
filter(contest_period != "Average") %>%
separate(contest_period, c("Beginning Period", "End Period")) %>%
select(-`Beginning Period`) %>%
separate(`End Period`, c("month_end", "year_end"), sep = -5)
# Cleaning December 1993
stock_clean$month_end[c(43, 143, 243)] = "December"
stock_clean$year_end[c(43, 143, 243)] = 1993
# Cleaning February
stock_clean$month_end[c(57, 157, 257)] = "February"
# Factor levels
month_levels <- c(
"January", "February", "March",
"April", "May", "June",
"July", "August", "September",
"October", "November", "December"
)
# Adding in Factor Levels To Original Data Set
stock_clean$month_end <- factor(stock_clean$month_end, month_levels)
#Renaming Variables
stock_clean <- stock_clean %>%
rename(Month = month_end, Year = year_end,
Portfolio = variable, Value = value)
# Original Graphic
p <- ggplot(stock_clean, aes(x = Month, y = Value,
color = Portfolio,
group = Portfolio)) +
geom_point() +
geom_line() +
facet_wrap(~ Year) +
theme_dark() +
labs(x = "",
y = "Value of Stock Portfolio (% Increase)",
title = "",
subtitle = "",
color = "Portfolio") +
geom_hline(yintercept = 0) +
theme(axis.text.x = element_text(angle = 300, hjust = -0.05, color = "black", size = 8),
title = element_text(size = 16))
#ggplotly
ggplotly(p) %>%
layout(margin = list(b = 100))
Description: Every individual year of portfolio trends are in separate graphics. Going from left to right, in a graphic, we progress from January to December. A black line was included to represent 0%. It should be noted that each dot represents the returns of the previous six months.
There were some general trends in this data set that are worth pointing out. (1) DJIA showed the least amount of variability across all months and years. (2) 1991 showed the largest stock surge across all portfolios. This happened during the center 2/3 of months in that year. (3) If any of the three portfolios were most likely to close under value it was DARTS. While PROS sometimes did, it didn’t do it as frequently nor as dramatically as DARTS.