Publications by Kitada Smalley

Model Selection

27.03.2020

Model Selection for MLB Salaries In this lesson we will be using the Hitters dataset from the ISLR package. These data reflect the salaries of baseball platers and various player metrics for the 1886 and 1987 seasons. library(ISLR) ## Warning: package 'ISLR' was built under R version 3.6.2 data("Hitters") names(Hitters) ## [1] "AtBat" "Hits"...

3791 sym R (20124 sym/66 pcs) 3 img

MATH266: CLT

30.03.2020

Simulating from Known Distributions During past few weeks of class we have taken a tour of well known distributions, such as: Bernoulli and Binomial Continuous Uniform Gamma, Exponential, and Chi-squared Normal We can use R, a statistical programming software/language to simulate draws from these distributions. R has many built in functions! # ...

680 sym R (2474 sym/13 pcs) 3 img

KNN Exercises

12.04.2020

K-Nearest Neighbors (KNN) In this exercise we will explore how to implement the KNN algorithm for classification. BINARY CASE Example #1: Stock Market Data 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 re...

3199 sym R (5478 sym/75 pcs) 5 img

MATH 138: Graphical and Numerical Summaries

02.09.2020

Introduction to Graphics in R We will be using data from my Fall 2020 classes for these graphics. Please import by logging into your class WISE page, setting the working directory, and calling the dataset. All data have been deidentified. How to load in data enrolled<-read.delim("enrolledFA2020.txt", header=TRUE) How to loo...

1407 sym R (11186 sym/55 pcs) 22 img

MATH138: Introduction to R and Tables

27.08.2020

An Introduction to R and Tables Welcome to R! R is the most popular statitical programming language. We are going to use it in this class to model data and learn about different statisitcal learning algorithms. Learning Objectives: Use basic operators Install packages Find help files Assess the structure of a dataframe Create frequency tables V...

3310 sym R (3572 sym/45 pcs) 6 img

Example R Markdown

03.09.2020

Practice with Dplyr This is a fake dataset about stocks library(tidyverse) # set the seed set.seed(1) stocks<-data.frame( time=as.Date('2009-01-01')+0:9, X=rnorm(n=10, mean=20, sd=1), Y=rnorm(n=10, mean=20, sd=2), Z=rnorm(n=10, mean=20, sd=4) ) stocks ## time X Y Z ## 1 2009-01-01 19.37355 23.02356 23.67...

94 sym R (1053 sym/5 pcs) 1 img

Lab 2: Dplyr SOLUTIONS

04.09.2020

Data Transformations with Dplyr Solutions The following are solutions to exercises from R For Data Science <https://r4ds.had.co.nz/transform.html. Prerequisites # Data wrangling and transformation #install.packages("nycflights13") library(nycflights13) ?flights #View(flights) head(flights) ## # A tibble: 6 x 19 ## year month day dep_time s...

886 sym R (8071 sym/37 pcs)

Example Hw#2

10.09.2020

College Dataset stuff about colleges… college<-read.csv("http://faculty.marshall.usc.edu/gareth-james/ISL/College.csv", header=TRUE) #View(college) head(college) ## X Private Apps Accept Enroll Top10perc Top25perc ## 1 Abilene Christian University Yes 1660 1232 721 23 52 ## ...

46 sym R (1634 sym/3 pcs) 1 img

More ggplot2 Tips and Tricks

05.10.2020

Switching between discrete and continuous representations library(tidyverse) data("diamonds") ggplot(diamonds) + geom_point(aes(carat, price)) # hard to see anything going on ggplot(diamonds) + geom_point(aes(carat, price, colour = depth)) # cut depth into five equisized groups, instead ggplot(diamonds) + geom_point(aes(carat, price, ...

304 sym R (1539 sym/14 pcs) 12 img

DataViz Class 3 Example

22.09.2020

R Markdown This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com. When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within t...

591 sym R (268 sym/2 pcs) 1 img