Publications by Matt Bodi

Quiz 1_Makeup

04.05.2020

## Load package library(tidyverse) # for cleaning, plotting, etc library(tidyquant) # for financial analysis Q1 Import Microsoft stock prices, instead of Apple. Hint: Insert a new code chunk below and type in the code, using the tq_get() function above. Replace the ticker symbol. Find ticker symbols from Yahoo Finance. ## Import data stocks <- t...

2717 sym R (1242 sym/5 pcs) 1 img

Quiz 6

28.04.2020

This note came from Matt Dancho’s webpage. Factor models are used in many financial appplications, suhc as: identifying the determinants of a security’s return cost of capital (rate of return required by an investor to hold the share) calculations Capital Asset Pricing Model (CAPM) is the most popular factor model. Although CAPM does not pe...

2838 sym R (5720 sym/10 pcs)

Quiz 5

23.04.2020

library(tidyquant) library(tidyverse) Q1 Import stock prices of NASDAQ Compsite Index, Microsoft and Walmart for the last 30 years. Hint: Add group_by(symbol) at the end of the code so that calculations below will be done per stock. # Import stock prices from = today() - years(30) Stocks <- tq_get(c("^IXIC", "WMT", "MSFT"), get = "stock.price...

4013 sym R (5712 sym/10 pcs) 1 img

Quiz4

14.04.2020

Q1 Import Tesla for the last ten months. Hint: Revise the given code below. library(tidyquant) library(tidyverse) # Import data from = today() - months(10) stock <- tq_get("TSLA", get = "stock.prices", from = from) stock ## # A tibble: 209 x 8 ## symbol date open high low close volume adjusted ## <chr> <date> <dbl> <dbl> <...

2593 sym R (4977 sym/7 pcs) 2 img

Quiz-3a

02.04.2020

Q1. dividends Import dividends of Apple and Microsoft since 2010. library(tidyquant) tq_get("WMT", get = "splits", from = "2010-01-01") Q2. economic data Import U.S. civilian unemployment rate (seasonally adjusted) since 2017. Hint: Find the symbol in FRED. tq_get("UNRATE", get = "economic.data", from = "2017-01-01...

1208 sym R (724 sym/8 pcs) 3 img

Quiz-3b

02.04.2020

stock.prices economic.data Merge Plot Q1. stock.prices Import S&P500 since 1999. Hint: Google tidyquant::tq_get() to find example codes. Q2. Prepare the imported stock prices for merge. Hint: Calculate yearly returns; create a new variable, year; and drop date. Q3 economic.data Import real U.S. GDP growth since 2000. Hint: Find the symbol in ...

1357 sym 2 img

Quiz 3

26.03.2020

# Load packages library(tidyquant) library(tidyverse) library(dplyr) Q1 economic data Import the U.S. Industrial Production Index since 2010. Hint: Find the symbol in FRED. Production <- tq_get("INDPRO",get = "economic.data",from = "2010-01-01") Production ## # A tibble: 122 x 2 ## date price ## <date> <dbl> ## 1 2010-01-01 ...

1905 sym R (2822 sym/12 pcs) 1 img

Quiz 2

27.02.2020

In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use Chapter 4.3 Categorical vs. Quantitative Data Visualization with R. # Load packages library(tidyquant) ## Loading required package: lubridate ## ## Attaching package: 'lubridate' ## The following object is masked from 'package:base': ## #...

2072 sym R (4663 sym/33 pcs) 3 img

Introduction to ggplot2

26.02.2020

# load data data(CPS85 , package = "mosaicData") ggplot # specify dataset and mapping library(ggplot2) ggplot(data = CPS85, mapping = aes(x = exper, y = wage)) geoms # add points ggplot(data = CPS85, mapping = aes(x = exper, y = wage)) + geom_point() # delete outlier library(dplyr) ## ## Attaching package: 'dplyr' ## The follo...

79 sym R (3918 sym/15 pcs) 10 img

Bivariate Graphs

26.02.2020

In this exercise you will learn to plot data using the ggplot2 package. To answer the questions below, use Chapter 4.3 Categorical vs. Quantitative Data Visualization with R. # Load packages library(tidyquant) library(tidyverse) # Import stock prices stock_prices <- tq_get(c("AAPL", "MSFT"), get = "stock.prices", from = "2020-01-01") stock_pri...

1136 sym R (1807 sym/9 pcs) 6 img