
Listed as Free on Udemy when checked on 8 November 2026. No coupon or subscription trial is required for the listed lessons. Enrollment needs a Udemy account; availability can change.
About this course
A regression curve may describe its fitting data well and still struggle with new observations. This free English course by Charles Redmond helps you explore that difference with training sets, test sets, R and ggplot. It combines statistical reasoning with small programming tasks, so you can follow how an error measurement is produced instead of treating a model score as an unexplained result.
The fifteen lectures span two sections and about ninety minutes of listed material. Updated in June 2015, the course assumes knowledge of R, ggplot and linear and polynomial regression. It is a continuation for learners with that foundation, with R and RStudio installed. Current interfaces may differ, and the recording does not promise a complete modern machine-learning workflow or a guaranteed completion time.
| Official course | Training Sets, Test Sets, R, and ggplot |
|---|---|
| Created by | Charles Redmond |
| Platform | Udemy |
| Language | English |
| Level | Intermediate |
| Listed duration | 91 minutes; 15 lectures across 2 sections |
| Completion terms | Not included with a new free enrollment |
What you’ll learn
Follow data from a table into separate fitting and assessment groups. Generate predictions, calculate mean squared error, and compare polynomial models using plots. Build confidence with row selection, for loops and functions with two arguments while exploring how model scores change when the division of the data changes.
Skills you’ll gain
- Data-frame row selection
- Training-data separation
- Prediction alignment
- Mean squared error calculation
- R loop construction
- Evaluation-bias awareness
Make the split visible
The opening section introduces row slicing and random selection, then plots the training and test data separately. This gives you a practical way to inspect the split before fitting a model. Keep row identifiers alongside the predictor and response so that you can check which observations belong to each group. A row should not silently appear in both groups within the same split.
The lessons use an equal-sized division as a teaching example. That is a design choice for the demonstration, not a rule that every analysis must follow. Consider the amount and structure of your data when choosing a split. Observations collected over time, or several rows belonging to one person or device, may need a time-aware or group-aware strategy instead of random row selection.
Calculate one score you can check by hand
Try an independent arithmetic exercise before automating the process. Suppose three held-out observations have response values four, seven and nine, and a previously fitted model predicts five, five and ten for those same rows. The observed-minus-predicted errors are minus one, two and minus one. Their squares are one, four and one, so the mean squared error is two.
These numbers are fictional and supplied only to check the calculation; they are not results from the instructor’s resources or a model trained for this article. If the response is measured in minutes, the MSE is measured in squared minutes. Taking its square root gives RMSE in minutes. Keep the metric name and units on your plot so that the size of an error remains interpretable.
For an R linear-model object, provide the held-out predictors through the prediction method’s `newdata` argument. Omitting it returns predictions based on the fitting data, which answers a different question. Preserve row alignment when comparing predictions with observed responses, and investigate missing values before averaging errors. A shorter prediction vector should not be paired blindly with a different set of observations.
Use repetition to understand uncertainty
The second section introduces loops, higher-degree models and functions with two arguments. It then combines these tools to repeat splits and visualize error across polynomial degrees. This offers a useful learning progression: verify one calculation, repeat it consistently, then look at how much the results move. A plot of several runs can show why one favorable split should not settle a modeling decision.
Keep model selection separate from final evaluation. If you repeatedly use a dataset’s scores to choose a polynomial degree, those observations have influenced your choice. They now serve a validation role rather than providing an untouched final test. Modern resampling guidance separates tuning from performance estimation; nested resampling is one possible approach, not an additional technique claimed for this short course.
Finish with a compact record of your split, fitted model, prediction rows and error calculation. Explain what was selected using those results and which data remained unused for selection. The course lists three downloadable resources, while the independent arithmetic exercise above requires none of them. A useful outcome is an evaluation you can trace and describe honestly, rather than an accuracy promise based on a single appealing graph.
Check prediction inputs: Distinguish predictions on newdata from fitted-data predictions. Review the MSE definition: Check the squared-error average and its relationship to RMSE.
Related courses for your next step
- Explore data frames in another languageFree Python Pandas Course
Compare how a separate course introduces series and data frames in Python.
Beginner
Frequently asked questions
Is this a first course in R?
No. It assumes a foundation in R, ggplot and linear and polynomial regression. It develops those skills through model evaluation and programming practice.
Is MSE expressed in the original response units?
No. MSE uses squared response units. RMSE is its square root and uses the original units.
Can I choose a model and report its final score on the same data?
That can produce an optimistic assessment. Data used to select a model have influenced the choice and should be distinguished from an untouched final test.
Learner reviews
Tell other learners what you actually tried. Reviews are moderated and may come from learners who have started or completed the course.
No published learner reviews yet.
Sign in to write a reviewQuestions still belong in the discussion below. Review and ranking rules.
Questions & discussion
Share a useful question or correction. Comments appear after moderation. Please avoid personal or sensitive information.