
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 fitted line becomes easier to understand when you can see the points it is trying to describe. This free English course by Charles Redmond introduces R, ggplot2 and simple linear regression through a visual progression. You begin with data objects and plotting, then connect scattered observations to a model and inspect the gaps between the observations and its fitted values.
The course has twenty-five lectures across four sections, totaling about two hours and thirteen minutes. Its material was updated in May 2015, so installation screens and package interfaces may differ today. The scope is introductory: vectors, data frames, plotting, simulated samples, least squares and basic prediction. It is suited to learners starting with R, rather than experienced users seeking advanced statistical theory.
| Official course | R, ggplot, and Simple Linear Regression |
|---|---|
| Created by | Charles Redmond |
| Platform | Udemy |
| Language | English |
| Level | Beginner |
| Listed duration | 134 minutes; 25 lectures across 4 sections |
| Completion terms | Not included with a new free enrollment |
What you’ll learn
Follow the relationship between a table, a scatterplot and a regression calculation. Explore how axes, colors and grouping affect a plot, how simulated samples create a cloud around a line, and how residuals describe what a fitted line misses. Use these connections to explain a small analysis in your own words before attempting a more complicated model.
Skills you’ll gain
- R data-frame navigation
- Scatterplot construction
- Plot grouping awareness
- Residual interpretation
- Least-squares reasoning
- Prediction-scope assessment
Make the picture and the calculation agree
The early lessons introduce RStudio, vectors and data frames before working with points and lines in ggplot2. That sequence gives you a useful study habit: identify which column provides each plotted coordinate, then check that a change in the table produces the change you expected in the graphic. A polished picture is easier to trust when you can trace its data.
For ordinary least squares, a residual is the observed response minus the fitted response at the same predictor value. On the usual scatterplot, this is a signed vertical difference, not the shortest perpendicular distance to the line. Squaring those residuals prevents positive and negative differences from cancelling in the fitting objective. R’s current `lm` documentation distinguishes the fitted values, residuals and coefficients returned by a model.
Try a small comparison before fitting a model
Use an independent practice table with four fictional packing tasks. Let the number of boxes be 1, 2, 3 and 4, and the recorded minutes be 3, 5, 4 and 8. These invented observations are for learning only; they do not describe a workplace or establish a productivity standard. Put the two columns into a data frame and sketch their scatterplot.
Compare the candidate line “minutes equals twice the box count” with the candidate line “minutes equals the box count plus two.” For the first, the fitted values are 2, 4, 6 and 8. The residuals are 1, 1, minus 2 and 0, whose squares sum to 6. For the second, the fitted values are 3, 4, 5 and 6, giving residuals 0, 1, minus 1 and 2, with the same squared total.
That tie is useful: equal scores for two proposed lines do not establish that either is the least-squares solution. Now use a simple linear model to find the best-fitting intercept and slope, and compare its residual total with both candidates. Keep your table, calculations and interpretation together. This is an editorial exercise, separate from the course’s father-and-son height example.
Specify the model you intend to draw
Modern ggplot2 can add a smooth curve using several different methods. Its default smoother is not automatically a straight least-squares line. If your intention is a linear fit, select the linear-model method explicitly and keep the formula consistent with your analysis. Also check the grouping: separate groups can produce separate fits rather than one model for all observations.
A prediction remains conditional on the model and its data. Extending the line far beyond the observed predictor range needs justification, and an observed association does not by itself establish causation. Distinguish an interval for a mean response from a prediction interval for an individual future observation. A narrow-looking graphic is not a guarantee that every new point will sit close to the line.
The recorded lessons are free, and an open-source RStudio Desktop edition is available separately from commercial Posit products. Use current installation guidance for your system and allow time for hands-on practice. Completing this introduction does not guarantee software compatibility, a professional qualification or a finished forecasting application. A good first outcome is a plot and a short explanation that accurately describe the same small dataset.
Read the current linear-model reference: Review the definitions of fitted values and residuals in R. Check plotting methods: Use the current ggplot2 reference when selecting a smoothing method.
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 an advanced statistics course?
No. It introduces R, plotting and simple linear regression for beginners. Detailed inference, validation and more complex models require further study.
Does a residual measure the shortest distance to the fitted line?
Not in ordinary response-on-predictor least squares. It is the observed response minus the fitted response at the same predictor value.
Is the packing-task example supplied by the instructor?
No. It is an independent editorial exercise using fictional observations, designed to connect a plot with residual calculations.
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.