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.
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.
[1] "CVS" "WBA" "UNH" "CI"
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.
Based on the daily Stock adjsted Prices chart and their individual candlestick chart, we can see clearly, Cigna is steadily trending up, UNH is up now compared to its price at the beginning of 2022, but it fluctuates a lot and has an obvious decline this summer, CVS is relatively steady not up and down, while Walgreens is trending down since this year. Thus, as a conservative investor, CI is a good company to invest in as it’s steadily trending up, and CVS is also good too as it’s stable and its Dividend yield is relatively high. UNH is also not bad, but may be a little risky. WBA is not recommeneded to invest in.
---
title: "Untitled"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: fill
social: menu
source: embed
html_document:
df_print: paged
pdf_document: default
---
```{r setup, include=FALSE}
library(flexdashboard)
```
---
# Table of Contents {.sidebar}
* Introduction
* Overview
* Companys Stocks Performances Detail
* Conclusion
# **Introduction**
Row {data-height=230}
-------------------------------------
### **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.
Row
-------------------------------------
### **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.
### **The Decision & Rules**
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.
# **Overview**
Row
-------------------------
### **Financial Indicators/Metrics**
+ `r kableExtra::text_spec("**P-E Ratio**", color = "#5c5c5c")` - It is the ratio of a company's share price to the company's earnings per share. This ratio is used for valuing companies and to find out whether they are overvalued or undervalued.
+ `r kableExtra::text_spec("**EPS**", color = "#5c5c5c")` - It is the portion of a company's profit that is allocated to every individual share of the stock and helps in understanding the financial strength of a company
+ `r kableExtra::text_spec("**Dividend Yield Ratio**", color = "#5c5c5c")` - is a financial ratio that shows how much a company pays out in dividends each year relative to its stock price.
+ `r kableExtra::text_spec("**Market Cap**", color = "#5c5c5c")` - the total value of a company's shares.
### **Key Indicator Analysis**
```{r}
library(quantmod)
library(plyr)
library(DT)
library(tidyquant)
library(dplyr)
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)
```
## Column {data-height=650 .tabset .tabset-fade}
### Overall Daily Trend {data-width=500}
```{r}
start <- as.Date("2022-01-01")
end <- as.Date("2022-09-30")
getSymbols(tickers, src = "yahoo", from = start, to = end)
stocks = as.xts(data.frame(A = CVS[, "CVS.Adjusted"],
B = WBA[, "WBA.Adjusted"], C = UNH[, "UNH.Adjusted"],
E = CI[,"CI.Adjusted"]))
```
``` {r}
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
```
### Facet Chart {data-width=500}
```{r}
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
```
# **Individual Stock Analysis - Candlestick Chart**
## Column {data-height=900 .tabset .tabset-fade}
``` {r}
# Libraries we need
library(tidyverse)
library(tidyquant)
# Configuring settings as per tidyquant tutorial
options("getSymbols.warning4.0"=FALSE)
options("getSymbols.yahoo.warning"=FALSE)
# The function
candleStick_plot<-function(symbol,from,to){
tq_get(symbol,
from = from,
to = to,
warnings = FALSE) %>%
mutate(greenRed=ifelse(open-close>0,
"Red",
"Green")) %>%
ggplot()+
geom_segment(aes(x = date,
xend=date,
y =open,
yend =close,
colour=greenRed),
size=3)+
theme_tq()+
geom_segment(aes(x = date,
xend=date,
y =high,
yend =low,
colour=greenRed))+
scale_color_manual(values=c("Forest Green","Red"))+
ggtitle(paste0(symbol," (",from," - ",to,")"))+
labs(y = "Price ($)",
x = "Date") +
theme(legend.position ="none",
axis.text.x = element_text(angle = 90, vjust = 0.5, hjust=1),
plot.title= element_text(hjust=0.5))
}
```
### UNH {data-width=900}
``` {r}
candleStick_plot("UNH",from = start,to = end)
```
### CI {data-width=900}
``` {r}
candleStick_plot("CI",from = start,to = end)
```
### CVS {data-width=900}
``` {r}
candleStick_plot("CVS",from = start,to = end)
```
### WBA {data-width=900}
``` {r}
candleStick_plot("WBA",from = start,to = end)
```
# **Conclusion**
Row
-------------------------
### **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:
+ `r kableExtra::text_spec("**P-E Ratio**", color = "#5c5c5c")` - 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).
+ `r kableExtra::text_spec("**EPS**", color = "#5c5c5c")` - 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).
+ `r kableExtra::text_spec("**Dividend Yield**", color = "#5c5c5c")` - 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.
+ `r kableExtra::text_spec("**Market Cap**", color = "#5c5c5c")` - 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.
### **Individual Trends Analysis**
Based on the daily Stock adjsted Prices chart and their individual candlestick chart, we can see clearly, Cigna is steadily trending up, UNH is up now compared to its price at the beginning of 2022, but it fluctuates a lot and has an obvious decline this summer, CVS is relatively steady not up and down, while Walgreens is trending down since this year. Thus, as a conservative investor, CI is a good company to invest in as it's steadily trending up, and CVS is also good too as it's stable and its Dividend yield is relatively high. UNH is also not bad, but may be a little risky. WBA is not recommeneded to invest in.