Publications by Reed Wilson
Module 14: Conclusion
Import your data # excel file airlines <- read_excel("../00_data/MyData.xlsx") %>% mutate(n_events = as.numeric(n_events)) %>% mutate(avail_seat_km_per_week = as.numeric(avail_seat_km_per_week)) airlines ## # A tibble: 336 × 6 ## Ref airline avail_seat_km_per_week year_range type_…¹ n_eve…² ## <dbl> <chr> ...
2443 sym 3 img
Week 14: Apply 13
# Load packages # Core library(tidyverse) library(tidyquant) # Source function source("../00_scripts/simulate_accumulation.R") 1 Import stock prices Revise the code below. Replace symbols with your stocks. Replace the from and the to arguments to date from 2012-12-31 to present. symbols <- c("TSLA", "GOOG","MSFT", "AAPL") prices <- tq_get(x ...
1400 sym R (5278 sym/24 pcs) 1 img
Week 14: Code Along 13
# 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...
453 sym R (8980 sym/36 pcs) 2 img
Module 13: Apply 12
Import your data data("mtcars") # excel file airlines <- read_excel("../00_data/MyData.xlsx") %>% mutate(n_events = as.numeric(n_events)) %>% mutate(avail_seat_km_per_week = as.numeric(avail_seat_km_per_week)) airlines ## # A tibble: 336 × 6 ## Ref airline avail_seat_km_per_week year_range type_…¹ n_eve…² ## <...
372 sym Python (11929 sym/41 pcs) 1 img
Week 13: Apply 12
# 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("TSLA", "GOOG","MSFT", "AAPL") prices <- tq_get(x = symbols, ...
1158 sym R (6715 sym/8 pcs) 1 img
Week 13: Code Along 12
# Load packages # Core library(tidyverse) library(tidyquant) library(readr) # Time series library(lubridate) library(tibbletime) # modeling library(broom) Goal Examine how each asset contributes to portfolio standard deviation. This is to ensure that our risk is not concentrated in any one asset. five stocks: “SPY”, “EFA”, “IJS”, �...
598 sym R (15558 sym/23 pcs) 2 img
Module 13: Code Along 12
Chapter 20 Vectors Introduction Vector Basics Important types of automic vector Using atomic vectors sample(10) + 10 ## [1] 11 17 19 20 16 18 14 15 13 12 1:10 + 1:2 ## [1] 2 4 4 6 6 8 8 10 10 12 1:10 + 1:3 ## Warning in 1:10 + 1:3: longer object length is not a multiple of shorter object ## length ## [1] 2 4 6 5 7 9 8 10 12 11 ...
330 sym Python (2093 sym/51 pcs)
Module 12: Code Along 11
Introduction 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) ) # Re-scale each column df$a <- (df$a - min(df$a, na.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm = TRUE)) df$b <- (df$b - min(df$b, na....
286 sym
Week 12: Code Along 11
Introduction 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) ) # Re-scale each column df$a <- (df$a - min(df$a, na.rm = TRUE)) / (max(df$a, na.rm = TRUE) - min(df$a, na.rm = TRUE)) df$b <- (df$b - min(df$b, na....
286 sym
Module 12: Apply 11
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...
458 sym 4 tbl