Publications by Daniel Lee
codeapply10
knitr::opts_chunk$set(echo = TRUE) # Load package library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.3 ✔ readr 2.1.4 ## ✔ forcats 1.0.0 ✔ stringr 1.5.0 ## ✔ ggplot2 3.4.3 ✔ tibble ...
400 sym R (4783 sym/23 pcs) 2 img
Code_Along 6
# 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 # Choose stocks symbols <- c("SPY", "EFA", "IJS", "EEM", "AGG") prices <- tq_get...
379 sym R (4531 sym/27 pcs) 2 img
Apply_6
# Load packages # Core library(tidyverse) library(tidyquant) Goal Visualize expected returns and risk to make it easier to compare the performance of multiple assets and portfolios. Choose your stocks. from 2012-12-31 to 2017-12-31 1 Import stock prices # Choose stocks symbols <- c("AMZN", "AAPL", "TSLA", "SPY", "EFA") # Using tq_get() ---- pr...
384 sym R (3257 sym/14 pcs) 1 img
Code_along-7
# Load packages # Core library(tidyverse) library(tidyquant) Goal Measure portfolio risk using skewness. Skewness is the extent to which returns are asymmetric around the mean. It is important because a positively skewed distribution means large positive returns are more likely while a negatively skewed distribution implies large negative returns...
608 sym R (4443 sym/17 pcs) 3 img
CodeAlong10
# 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 # Choose stocks symbols <- c("AGG", "EEM", "EFA", "IJS", "SPY") prices <- tq_get...
475 sym R (3537 sym/17 pcs) 2 img
Apply9
# 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 # Choose stocks symbols <- c("AAPL", "DIS", "NKE", "SBUX", "GE") prices <- tq_get(x = symbols...
830 sym R (3478 sym/16 pcs) 1 img
Code Along 10 Jason
Ch15 Factors Creating factors General Social Survey gss_cat ## # A tibble: 21,483 × 9 ## year marital age race rincome partyid relig denom tvhours ## <int> <fct> <int> <fct> <fct> <fct> <fct> <fct> <int> ## 1 2000 Never married 26 White $8000 to 9999 Ind,near … Prot… Sout… 12 ## ...
429 sym 4 img
Code Along 10
knitr::opts_chunk$set(echo = TRUE) library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.3 ✔ readr 2.1.4 ## ✔ forcats 1.0.0 ✔ stringr 1.5.0 ## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1 ## ✔ lu...
464 sym R (9280 sym/51 pcs) 4 img
Code Along 10
# Load packages # Core library(tidyverse) library(tidyquant) Goal Measure the portfolio’s beta coefficient, which can be thought of as the portfolio’s sensitivity to the market or its riskiness relative to the market. five stocks: “SPY”, “EFA”, “IJS”, “EEM”, “AGG” market: “SPY” from 2012-12-31 to 2017-12-31 1 Imp...
540 sym R (3547 sym/17 pcs) 2 img
Code Along 9
library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.3 ✔ readr 2.1.4 ## ✔ forcats 1.0.0 ✔ stringr 1.5.0 ## ✔ ggplot2 3.4.3 ✔ tibble 3.2.1 ## ✔ lubridate 1.9.2 ✔ tidyr 1.3.0 ## ...
898 sym R (5283 sym/24 pcs) 2 img