Publications by H. K. Tseng

Statistical Learning: Week 6

22.03.2024

Polynomial regression and the use of \(\texttt{poly()}\) function. set.seed(123) n = 10 xr = seq(0, n, by = 0.1) # generate a sequence of numerical values, from 0 to n=10, by an increment of 0.1 # generate a random data from a sin function plus some random errors yr = sin(xr/2) + rnorm(length(xr))/2 # combine x and y into a df for easy manipu...

896 sym R (26965 sym/88 pcs) 20 img

Statistical Learning: Week 5

15.03.2024

Binary outcome as a generalization of linear regression model with limited dependent variables Estimating a model of binary outcome using lm() function library(ISLR) ## Warning: package 'ISLR' was built under R version 4.3.3 data(Default) names(Default) ## [1] "default" "student" "balance" "income" ## convert the outcome variable "default" to num...

850 sym R (36463 sym/154 pcs) 7 img

Statistical Learning: Week 4

08.03.2024

Non-normality test ## load Prestige data from the "car" package library(car) ## Loading required package: carData lm.fit <- lm(prestige ~ education, data = Prestige) plot(lm.fit) ## Shapiro test of normality shapiro.test(Prestige$prestige) ## ## Shapiro-Wilk normality test ## ## data: Prestige$prestige ## W = 0.97198, p-value = 0.02875 ...

1177 sym R (32315 sym/105 pcs) 15 img

Statistical Learning: Week 3

02.03.2024

Fitting a linear model A description of variable names and measures can be seen here install.packages("ISLR") ## Installing package into 'C:/Users/hktse/AppData/Local/R/win-library/4.3' ## (as 'lib' is unspecified) ## package 'ISLR' successfully unpacked and MD5 sums checked ## ## The downloaded binary packages are in ## C:\Users\hktse\AppDat...

345 sym R (12970 sym/66 pcs) 5 img

Statistical Learning: Week 2

23.02.2024

Installing R and RStudio R is a programming language and free software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing. RStudio is an integrated development environment for R, a programming language for statistical computing and graphics. You need to download base R in order to run RS...

2641 sym R (12924 sym/121 pcs) 12 img

Statistical Learning: Week-15

26.05.2023

U.S. Armament Cooperation Network at a glance: 1992-2017 Structural Topic Models (STM) A gentle introduction using international armament cooperation (IAC) data # load required packages and data library(stm) ## stm v1.3.6 successfully loaded. See ?stm for help. ## Papers, resources, and other materials at structuraltopicmodel.com # load our ...

214 sym R (7778 sym/32 pcs) 9 img

Statistical Learning: Week-14

21.05.2023

Stripping raw text Stripping raw text using unnest_tokens() # load required packages # install.packages(c("tibble", "tidytext", "ggplot2", "gutenbergr", "tidyr")) library(tibble) library(tidytext) library(ggplot2) library(gutenbergr) library(tidyr) # example text text <- c("A market meltdown. Surging recession fears. And a sudden spotlight...

454 sym R (48640 sym/110 pcs) 11 img

Statistical Learning: Week-13

12.05.2023

Leave-One-Out cross validation (LOOCV) Model validation using LOOCV # load required packages and data (we will be using AmesHousing data) # install.packages(c("boot", "rsample", "AmesHousing")) library(ISLR) library(caret) ## Loading required package: ggplot2 ## Loading required package: lattice library(rsample) library(boot) ## ## Attaching ...

379 sym R (17713 sym/59 pcs) 1 img

Statistical Learning: Week-12

06.05.2023

\(K\)-means and hierarchical clustering for wine types Apply \(K\)-means and hierarchical clustering to wine data # load required packages and data (wine data) install.packages(c("HDclassif", "useful", "factoextra")) ## Installing packages into 'C:/Users/hktse/Documents/R/win-library/3.6' ## (as 'lib' is unspecified) ## package 'HDclassif' succ...

326 sym R (15142 sym/117 pcs) 7 img

Statistical Learning: Week-11

30.04.2023

Naïve Bayes ## load required packages and data library(dplyr) ## ## Attaching package: 'dplyr' ## The following objects are masked from 'package:stats': ## ## filter, lag ## The following objects are masked from 'package:base': ## ## intersect, setdiff, setequal, union library(ggplot2) library(tidyr) library(caret) ## Loading re...

695 sym R (59626 sym/249 pcs) 18 img