Publications by Owen Pedi

Code_Along_13

02.05.2023

# Load packages # Core library(tidyverse) library(tidyquant) # time series library(timetk) Goal Simulate future portfolio returns five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” market: “SPY” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbol...

409 sym R (8956 sym/32 pcs)

Apply_12

27.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Examine how each asset contributes to portfolio standard deviation. This is to ensure that our risk is not concentrated in any one asset. 1 Import stock prices Choose your stocks from 2012-12-31 to present. symbols <- c("APPL", "LUV", "NKE", "MSFT") prices <- tq_get(x = symbol...

546 sym R (4737 sym/9 pcs)

Code_Along_12

25.04.2023

...

4 sym 2 img

Apply_11

23.04.2023

Import your data data(flights) flights %>% skimr::skim() Data summary Name Piped data Number of rows 336776 Number of columns 19 _______________________ Column type frequency: character 4 numeric 14 POSIXct 1 ________________________ Group variables None Variable type: character skim_variable n_missing complete_rate min max empty n_un...

499 sym 4 tbl

Code_Along_11

17.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Functions When should you write a function? # For reproducible work set.seed(1234) # Create a data frame df <- tibble::tibble( a = rnorm(10), b = rnorm(10), c = rnorm(10), d = rnorm(10) ) # Rescale each column df$a <- (df$a - min(df$a, na.rm =TRUE)) / (max(df$a, na.rm...

290 sym R (2458 sym/24 pcs)

Apply_10

12.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Calculate and visualize your portfolio’s beta. Choose your stocks and the baseline market. from 2012-12-31 to present 1 Import stock prices symbols <- c("AAPl", "LUV", "NKE", "MSFT") prices <- tq_get(x = symbols, from = "2012-12-31", to = "2017-...

801 sym R (3069 sym/17 pcs) 1 img

code_along_10

11.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbols, ...

435 sym R (3218 sym/17 pcs) 2 img

Apply_9

04.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize and examine changes in the underlying trend in the performance of your portfolio in terms of Sharpe Ratio. Choose your stocks. from 2012-12-31 to present 1 Import stock prices symbols <- c("AAPl", "LUV", "NKE", "MSFT") prices <- tq_get(x = symbols, from ...

1010 sym R (3714 sym/17 pcs) 1 img

Code_Along_9

04.04.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Collect individual returns into a portfolio by assigning a weight to each stock five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” from 2012-12-31 to 2017-12-31 1 Import stock prices symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get(x = symbols, ...

448 sym R (4650 sym/18 pcs) 3 img

apply_8

30.03.2023

# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize and examine changes in the underlying trend in the downside risk of your portfolio in terms of kurtosis. Choose your stocks. from 2012-12-31 to present 1 Import stock prices symbols <- c("AAPl", "LUV", "NKE", "MSFT") prices <- tq_get(x = symbols, from = ...

894 sym R (2631 sym/15 pcs) 1 img