Publications by PhamMinhTam
In-class Exercise 3: LDA
Analyzing the dataset library(MASS) table(iris$Species) ## ## setosa versicolor virginica ## 50 50 50 #create a lookup table that maps each species name to a corresponding color lookup <- c(setosa='blue', versicola='green', virginica='orange') #Using the lookup table to create a new vector that contains the corr...
2138 sym R (2165 sym/13 pcs) 3 img
Midterm Exam: Portfolio Analysis
1. Import Data Load librarties library(fBasics) library(kableExtra) library(dplyr) library(tidyquant) library(lubridate) library(timetk) library(purrr) library(quantmod) Get data from Yahoo symbols <- c("SPY","QQQ", "EEM", "IWM", "EFA", "TLT", "IYR", "GLD") portfolioPrices <- NULL for (symbol in symbols) { portfolioPrices <- cbind(po...
820 sym R (10566 sym/24 pcs) 2 tbl
HW03_Application of Financial Software Package
library(ISLR2) library(MASS) ## ## Attaching package: 'MASS' ## The following object is masked from 'package:ISLR2': ## ## Boston attach(Smarket) train <- (Year < 2005) Smarket.2005 <- Smarket[!train, ] Direction.2005 <- Direction[!train] 3. Linear Discriminant Analysis lda.fit <- lda(Direction ~ Lag1+ Lag2, data = Smarket, subset = t...
10422 sym R (5689 sym/88 pcs) 1 img
Chapter 4: Classification - Labs
Lab: Classification Methods 1. The Stock Market Data library(ISLR2) The Smarket data is part of the ISLR2 library. This data set consists of percentage returns for the S&P 500 stock index over 1, 250 days, from the beginning of 2001 until the end of 2005. For each date, we have recorded the percentage returns for each of the five previous trad...
6388 sym R (6272 sym/48 pcs) 1 img
HW03_Investment Portfolio Analysis
Libraries library(readr) library(xts) ## Loading required package: zoo ## ## Attaching package: 'zoo' ## The following objects are masked from 'package:base': ## ## as.Date, as.Date.numeric library(dplyr) ## ## ######################### Warning from 'xts' package ########################## ## # ...
424 sym R (4529 sym/29 pcs)
InClass_02
Libraries library(broom) library(MASS) library(ISLR2) ## ## Attaching package: 'ISLR2' ## The following object is masked from 'package:MASS': ## ## Boston library(tidymodels) ## ── Attaching packages ────────────────────────────────────── tidymodels 1.1.1 ─...
1502 sym R (3179 sym/20 pcs) 2 img
Chapter 3: Applied Exercise
Libraries library(MASS) library(ISLR2) ## ## Attaching package: 'ISLR2' ## The following object is masked from 'package:MASS': ## ## Boston Exercise 8. This question should be answered using the Auto data set. (a) Perform a simple linear regression with mpg as the response and horsepower as the predictor. Comment on the output data("...
7462 sym R (8210 sym/40 pcs) 16 img 1 tbl
Chapter 3: Linear Regression - Labs
Lab: Linear Regression 1. Libraries library(MASS) library(ISLR2) ## ## Attaching package: 'ISLR2' ## The following object is masked from 'package:MASS': ## ## Boston 2. Simple Linear Regression head(Boston) ## crim zn indus chas nox rm age dis rad tax ptratio lstat medv ## 1 0.00632 18 2.31 0 0.538 6.575 65.2 4.0900 ...
280 sym R (12768 sym/63 pcs) 12 img
HW02_Investment Portfolio Analysis
Import Libraries 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.4 ✔ tibble 3.2.1 ## ✔ lubridate 1.9.3 �...
2862 sym R (6525 sym/33 pcs)
Chapter 2 - Exercise 9
Libraries library(ISLR2) 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.4 ✔ tibble 3.2.1 ## ✔ lubridate 1.9...
445 sym R (2196 sym/11 pcs)