Data Source

Healthcare Stock Price Data

Data Download

This dataset was downloaded from Yahoo Finance via Rstudio. It includes the adjusted close stock price for Pfizer, AstraZeneca, UnitedHealth Group Incorporated, Johnson & Johnson, CVS, and Stryker from 2000/2/2 to 2023/2/2.

Show the code
library(flipbookr)
library(tidyverse)
library(ggplot2)
library(forecast)
library(astsa) 
library(xts)
library(tseries)
library(fpp2)
library(fma)
library(lubridate)
library(tidyverse)
library(TSstudio)
library(quantmod)
library(tidyquant)
library(plotly)
library(ggplot2)

options("getSymbols.warning4.0"=FALSE)
options("getSymbols.yahoo.warning"=FALSE)

tickers = c("PFE","UNH","JNJ", "AZN", "SYK", "CVS","LLY")
for (i in tickers){
  getSymbols(i,
             from = "2010-1-1",
             to = "2023-1-29")}

x <- list(
  title = "date"
)
y <- list(
  title = "value"
)

stock <- data.frame(PFE$PFE.Adjusted,
                    UNH$UNH.Adjusted,
                    AZN$AZN.Adjusted,
                    SYK$SYK.Adjusted,
                    CVS$CVS.Adjusted,
                    JNJ$JNJ.Adjusted,
                    LLY$LLY.Adjusted)


stock <- data.frame(stock,rownames(stock))
colnames(stock) <- append(tickers,'Dates')

stock$date<-as.Date(stock$Dates,"%Y-%m-%d")
write.csv(stock, 'data/stock.csv', row.names = FALSE)
#head(stock)

Screenshot of Stock Prices

National Health Expenditure (NHE) Data

Data Download

This dataset contains yearly summary statistics of over 50 years of NHE data from various perspective, including amount in billions, per capita amount, and average annual percent change from previous year shown. The data set is available from CMS.gov.

Screenshot of NHE Dataset