Publications by Leo Tzang

makeuptest

20.06.2024

## Loading required package: Matrix ## Loaded glmnet 4.1-8 ## [1] 14.88459 ## [1] 1.184701 ## [1] 1.23797 ## alpha mse fit.name ## 1 0.0 14.918840 alpha0 ## 2 0.1 2.256924 alpha0.1 ## 3 0.2 1.472927 alpha0.2 ## 4 0.3 1.362394 alpha0.3 ## 5 0.4 1.259794 alpha0.4 ## 6 0.5 1.252103 alpha0.5 ## 7 0.6 1.253330 alpha...

9 sym

Make up test

18.06.2024

if (!requireNamespace("glmnet", quietly = TRUE)) { install.packages("glmnet") } library(glmnet) ## Warning: package 'glmnet' was built under R version 4.3.3 ## Loading required package: Matrix ## Warning: package 'Matrix' was built under R version 4.3.2 ## Loaded glmnet 4.1-8 ## Example 1 ## 4085 useless variables in the model, only 15 that a...

18 sym R (4290 sym/15 pcs)

Final exam

13.06.2024

#Chapter4 Q16 #Load dataset # Install necessary packages if not already installed if (!requireNamespace("MASS", quietly = TRUE)) { install.packages("MASS") } if (!requireNamespace("caret", quietly = TRUE)) { install.packages("caret") } if (!requireNamespace("e1071", quietly = TRUE)) { install.packages("e1071") } if (!requireNamespace("class"...

110 sym R (18862 sym/107 pcs)

Document

13.06.2024

#CHAPTER4 library(MASS) library(caret) ## Loading required package: ggplot2 ## Loading required package: lattice # Load the Boston data set data("Boston") # Create the response variable median_crime <- median(Boston$crim) Boston$HighCrime <- ifelse(Boston$crim > median_crime, 1, 0) Boston$HighCrime <- factor(Boston$HighCrime) # Summary of the new...

49 sym R (15986 sym/44 pcs) 2 img

Munkhzul Final

10.06.2024

#Munkhzul Final library(tidyquant) ## Warning: package 'tidyquant' was built under R version 4.3.3 ## Loading required package: lubridate ## ## Attaching package: 'lubridate' ## The following objects are masked from 'package:base': ## ## date, intersect, setdiff, union ## Loading required package: PerformanceAnalytics ## Loading required...

35 sym R (8283 sym/32 pcs)

Shurtsetseg

10.06.2024

library(tidyquant) ## Loading required package: lubridate ## ## Attaching package: 'lubridate' ## The following objects are masked from 'package:base': ## ## date, intersect, setdiff, union ## Loading required package: PerformanceAnalytics ## Loading required package: xts ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The...

33 sym R (8860 sym/30 pcs)

Document

27.05.2024

#======================================== # FamaFrench_mon_69_98_3stocks # one factor model # ff three factor model #======================================== library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ re...

44 sym R (25781 sym/38 pcs) 3 img

In Class Exercise

27.05.2024

#======================================== # FamaFrench_mon_69_98_3stocks # one factor model # ff three factor model #======================================== library(tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## ✔ dplyr 1.1.4 ✔ re...

46 sym R (41870 sym/41 pcs) 2 img

HW

26.05.2024

By following the 5 factor model and 10 industry monthly returns based on Fama-French database website. (https://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html), you can construct the MVP portfolio and its monthly returns using the previous 5-year monthly returns data. Show its cumulative returns starting from 1969. library(tidyve...

351 sym R (4782 sym/11 pcs) 1 img

Document

16.05.2024

library(tidymodels) ## ── Attaching packages ────────────────────────────────────── tidymodels 1.2.0 ── ## ✔ broom 1.0.5 ✔ recipes 1.0.10 ## ✔ dials 1.2.1 ✔ rsample 1.2.1 ## ✔ dplyr 1.1.4 ✔ tibble 3.2....

42 sym R (11020 sym/38 pcs) 1 img