# Table of Contents {.sidebar}
Introduction
Overview
Companys Stocks Performances Detail
Conclusion
### Overview Due to the inherent growth in the electronic production and storage of information, there is often a feeling of “information overload” or inundation when facing the process of quantitative decision making. As an analyst your job will often be to conduct analyses or create tools to support quantitative decision making.
A principle tool used in industry, government, non-profits, and academic fields to compensate for the information overload is the information dashboard. Functionally, a dashboard is meant to provide a user with a central resource to present in a clear and concise manner all the information necessary to support day-to-day decision making and support operations.
### Objective
The objective of this laboratory is to plan, design, and create an information dashboard to support quantitative decision making. To accomplish this task, you will have to complete a number of steps:
1.Delineate the necessary decision (I will do that below). 2.Identify what information will be relevant to decision making. 3.Find and collect the data necessary to create your visualization plan. 4.Organize and summarize the collected data. 5.Design and create the best visualizations to present that information. 6.Finally organize the layout of those visualizations in a way that conforms to the theory of dashboarding. 7.Write a summary about what decisions you made based on the visualizations that you developed.
You make investments for an organization; your objective is to purchase securities/commodities for the key objective of maximizing profits. You want to make an investment in securities/commodities to make some short-term gains. You are considering investing in one of any four companies, for example: Twitter (TWTR), Microsoft (MSFT), or Apple (AAPL) (don’t use these). Choose 4 companies or commodities and determine which one of the four will produce the most short-term gains. Use your imagination.
### Financial Indicators/Metrics
library(quantmod)
## Loading required package: xts
## Loading required package: zoo
##
## Attaching package: 'zoo'
## The following objects are masked from 'package:base':
##
## as.Date, as.Date.numeric
##
## ################################### WARNING ###################################
## # We noticed you have dplyr installed. The dplyr lag() function breaks how #
## # base R's lag() function is supposed to work, which breaks lag(my_xts). #
## # #
## # If you call library(dplyr) later in this session, then calls to lag(my_xts) #
## # that you enter or source() into this session won't work correctly. #
## # #
## # All package code is unaffected because it is protected by the R namespace #
## # mechanism. #
## # #
## # Set `options(xts.warn_dplyr_breaks_lag = FALSE)` to suppress this warning. #
## # #
## # You can use stats::lag() to make sure you're not using dplyr::lag(), or you #
## # can add conflictRules('dplyr', exclude = 'lag') to your .Rprofile to stop #
## # dplyr from breaking base R's lag() function. #
## ################################### WARNING ###################################
## Loading required package: TTR
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
library(plyr)
library(DT)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:plyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## The following objects are masked from 'package:xts':
##
## first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(highcharter)
library(viridisLite)
library(ggplot2)
library(broom)
library(xts)
library(zoo)
what_metrics <- yahooQF(c("Price/Sales",
"P/E Ratio",
"Price/EPS Estimate Next Year",
"PEG Ratio",
"Dividend Yield",
"Market Capitalization"))
tickers <- c("CVS", "WBA", "UNH", "CI")
metrics <- getQuote(paste(tickers, sep = ",", collapse = ";"), what = what_metrics)
metrics <- data.frame(Symbol = tickers, metrics[,2:length(metrics)])
colnames(metrics) <- c("Symbol", "P-E Ratio", "EPS", "Dividend Yield Ratio", "Market Cap")
DT::datatable(metrics)
start <- as.Date("2022-01-01")
end <- as.Date("2022-09-30")
getSymbols(tickers, src = "yahoo", from = start, to = end)
## [1] "CVS" "WBA" "UNH" "CI"
stocks = as.xts(data.frame(A = CVS[, "CVS.Adjusted"],
B = WBA[, "WBA.Adjusted"], C = UNH[, "UNH.Adjusted"],
E = CI[,"CI.Adjusted"]))
names(stocks) <- c("CVS", "WBA", "UNH","CI")
index(stocks) <- as.Date(index(stocks))
stocks_series <- tidy(stocks) %>%
ggplot(aes(x=index,y=value, color=series)) +
labs(title = "Daily Stock Adjusted Prices Comparison from 01~09/2022",
subtitle = "Among CVS, Walgreens, UnitedHealth Group, Cigna",
caption = " Source: Yahoo Finance",
color = "Stock",
x = "Date",
y = "End of day Adjusted Price ($)") +
scale_color_manual(values = c("Red", "Green", "DarkBlue","Orange"))+
geom_line()
stocks_series
stocks_series2 = tidy(stocks) %>%
ggplot(aes(x=index,y=value, color=series)) +
geom_line() +
facet_grid(series~.,scales = "free") +
labs(title = "Daily Stock Adjusted Prices Comparison from 01~09/2022",
subtitle = "Among CVS, Walgreens, UnitedHealth Group, Cigna",
caption = " Source: Yahoo Finance",
color = "Stock",
x = "Date",
y = "End of day Adjusted Price ($)") +
scale_color_manual(values = c("Red", "Green", "DarkBlue","Orange"))
stocks_series2
### Key Indicators Analysis By analyzing key indicators such as “P/E Ratio”, “Price/EPS Estimate Next Year”, “Dividend Yield” and “Market Capitalization” to compare four different companies’s (CVS, UnitedHealth Group, Walgreens, and Cigna) performance from Jan 1, 2022 to Sept 31, 2022, we can see:
P-E Ratio - UNH has the highest P-E Ratio (26.5), which means that investors are expecting higher earnings growth in the future, then followed by Cigna (18.3), CVS (15.4) and Walgreens (6.9).
EPS - According to EPS, UNH is also the highest one with 21.7, which indicates how much money a company makes for each share of its stock, followed by Cigna (12.1), CVS (10.5) and Walgreens (7.3).
Dividend Yield - Based on dividend yield, Walgreens has the highest (5.6%), followed by CVS (2.3%), Cigna (1.4%) and UNH (1.2%), which indicates though Walgreens is not advantageous in P-E Ratio nor EPS, its high Dividend yield is good for investors to gain dividends.
Market Cap - From the market capitalization perspective, UNH is the highest, followed by CVS and Cigna. Overall, from the key indicators, UNH is a better company to invest in among others, then Cigna, CVS and Walgreens.
Base on the graphs, I would invest in CI and CVS since they are steadily trending up, moreover CVS is also good too as it’s stable and its Dividend yield is relatively high.