Publications by Joey Campbell
Rfacets03_demo
1. What happens if you facet on a continuous variable? Let’s see. ggplot(mpg, aes(x = displ, y = hwy)) + geom_point() + facet_grid(. ~ cty) The continuous variable is converted to a categorical variable, and the plot contains a facet for each distinct value. 2. What do the empty cells in plot with facet_grid(drv ~ cyl) mean? How do they...
10991 sym R (619 sym/7 pcs) 7 img
Raesthetics02_demo
1. What’s gone wrong with this code? Why are the points not blue? suppressPackageStartupMessages(library(tidyverse)) package 㤼㸱tidyverse㤼㸲 was built under R version 3.6.3 ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, colour = "blue")) The argument colour = "blue" is included within the mapping argument, and as su...
9456 sym R (2224 sym/13 pcs) 7 img
Rviz01_demo
Introduction library("tidyverse") ## Warning: package 'tidyverse' was built under R version 3.6.3 ## -- Attaching packages ----------------------------------------- tidyverse 1.3.0 -- ## v ggplot2 3.2.1 v purrr 0.3.3 ## v tibble 2.1.3 v dplyr 0.8.3 ## v tidyr 1.0.0 v stringr 1.4.0 ## v readr 1.3.1 v forcats 0.4.0 ## --...
1483 sym R (2090 sym/16 pcs) 3 img 1 tbl
Lab 9 Support Vector Machines
We use the e1071 library in R to demonstrate the support vector classifier and the SVM. Another option is the LiblineaR library, which is useful for very large linear problems. Support Vector Classifier The e1071 library contains implementations for a number of statistical learning methods. In particular, the svm() function can be used to fit a ...
31186 sym R (5882 sym/67 pcs) 13 img
R Assignment 4 Problem 3
Let’s try this again. Load the Gross Domestic Product data for the 190 ranked countries in this data set: https://raw.githubusercontent.com/uky994/STA-4233.-INTRODUCTION-TO-PROGRAMMING-AND-DATA-MANAGEMENT-IN-R/master/GDP.csv Load the educational data from this data set: https://raw.githubusercontent.com/uky994/STA-4233.-INTRODUCTION-TO-PROGRAM...
761 sym R (1719 sym/11 pcs)
Lab 7 Non-linear Modeling
In this lab, we re-analyze the Wage data considered in the examples throughout this chapter, in order to illustrate the fact that many of the complex non-linear fitting procedures discussed can be easily implemented in R. We begin by loading the ISLR library, which contains the data. library(ISLR) Attaching package: 㤼㸱ISLR㤼㸲 The follow...
37102 sym R (9372 sym/82 pcs) 12 img
Lab 6c PCR and PLS Regression
Principal Components Regression Principal components regression (PCR) can be performed using the pcr() function, which is part of the pls library. We now apply PCR to the Hitters data, in order to predict Salary. Again, ensure that the missing values have been removed from the data, as described in Section 6.5. library(ISLR) Attaching package: �...
10790 sym R (4313 sym/20 pcs) 3 img
Lab 6b Ridge Regression and the Lasso
We will use the glmnet package in order to perform ridge regression and the lasso. The main function in this package is glmnet(), which can be used to fit ridge regression models, lasso models, and more. This function has slightly different syntax from other model-fitting functions that we have encountered thus far in this book. In particular, we...
20365 sym R (6278 sym/51 pcs) 3 img
Lab 6a Subset Selection Methods
Best Subset Selection Here we apply the best subset selection approach to the Hitters data. We wish to predict a baseball player’s Salary on the basis of various statistics associated with performance in the previous year. First of all, we note that the Salary variable is missing for some of the players. The is.na() function can be used to iden...
24429 sym R (16174 sym/65 pcs) 3 img
Lab 4: Logistic Regression, LDA, QDA, and KNN
The Stock Market Data We will begin by examining some numerical and graphical summaries of the Smarket data, which is part of the ISLR 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 ...
52124 sym R (9246 sym/122 pcs) 3 img