# Training Sets, Test Sets, R, and ggplot

How to evaluate regression model performance in R
Rating: 4.5 out of 5 (669 ratings)
17,781 students
English
English [Auto]
randomly divide a data set into a training set and a test set
calculate the test MSE (mean squared error)
calculate quickly the MSE for a number of models
visualize the variability of the MSE with ggplot
row-slice data frames
use R's predict function
write for loops in R
write functions of two variables in R
combine functions and for loops
add titles and labels to plots in ggplot

## Requirements

• It is necessary that the students have the background one would get by viewing my two Udemy courses on linear and polynomial regression.
• Students will need to have R and RStudio installed on their own computers.

## Description

In this course, I show you how to evaluate the performance of a regression model using training sets and test sets. We will use R and ggplot as our tools. Along the way, we will learn how to row-slice data frames, use the predict function in R, and add titles and labels to our plots. We will also work on our programming skills by learning how to write for loops and functions of two variables.

Students should have the background in R, ggplot, and regression equivalent to what one would have after viewing my two Udemy courses on linear and polynomial regression. At a relaxed pace, it should take about two weeks to complete the course.

## Who this course is for:

• This course is for those looking to improve their R programming skills.
• This course is for those with the background equivalent to what one would have after viewing my first two Udemy courses in linear and polynomial regression.

## Course content

2 sections15 lectures1h 30m total length
• Introduction
01:28
• Row-slicing Data Frames
08:01
• Plotting the Training and Test Sets
07:37
• Plotting the Least-Squares Line
09:43
• Calculating the Test MSE
05:58
• Generating a Quadratic Model
06:59
• Calculating the Test MSE for the Quadratic Model
02:42

## Instructor

Professor at Mercyhurst University

Dr. Charles Redmond is a professor in the Tom Ridge School of Intelligence Studies and Information Science at Mercyhurst University. He has been a member of the Department of Mathematics and Computer Systems at Mercyhurst for 21 years and has recently completed a term as chair of the department. Dr. Redmond received his PhD in mathematics from Lehigh University in 1993 and has published in the Annals of Applied Probability, the Journal of Stochastic Processes and Their Applications, Mathematics Magazine, the College Mathematics Journal, and Mathematics Teacher. In his spare time he enjoys making music and computer generated art, reading, and owning a Clumber Spaniel.