Estimated marginal means (EMMs)—sometimes called least-squares means—are a powerful way to interpret and visualize results from linear and mixed-effects models. Yet many researchers struggle to extract, understand, and plot them.
In this 60-minute hands-on tutorial, participants will learn how to compute, interpret, and visualize EMMs using only base R functions together with the emmeans, car, and lme4 packages. We will start with simple linear models and progress to mixed models with random effects, highlighting how to obtain EMMs, confidence intervals, pairwise contrasts, and publication-ready base R plots. The session emphasizes conceptual understanding and practical code you can adapt immediately to your own analyses.
Note: This training is an exclusive benefit to members of the Statistically Speaking Membership Program and part of the Stat’s Amore Trainings Series. Each Stat’s Amore Training is approximately 90 minutes long.
About the Instructor
Manolo Romero Escobar is a seasoned statistical consultant and psychometrician with a passion for helping researchers.
Throughout his career, Manolo has worked extensively as a research and statistical consultant. He has served a diverse range of clients including health researchers, educational institutions, and government agencies. With a focus on linear mixed effects modeling, latent variable modeling, and scale development, Manolo brings a wealth of knowledge and experience to every project he undertakes.
Manolo is also proficient in statistical programming languages such as R, SPSS, and Mplus, and has experience with Python and SQL. He is passionate about leveraging technology as an educational and training tool, and he continuously enhances his skills to stay at the forefront of his field.
He holds a B.A. and Licentiate degree in Psychology from Universidad del Valle de Guatemala and a M.A. in Psychology (Area: Developmental and Cognitive Processes) from York University.
Not a Member Yet?
It’s never too early to set yourself up for successful analysis with support and training from expert statisticians.
Just head over and sign up for Statistically Speaking.
You'll get access to this training webinar, 130+ other stats trainings, a pathway to work through the trainings that you need — plus the expert guidance you need to build statistical skill with live Q&A sessions and an ask-a-mentor forum.

In Part 1 we installed R and used it to create a variable and summarize it using a few simple commands. Today let’s re-create that variable and also create a second variable, and see what we can do with them.
As before, we take height to be a variable that describes the heights (in cm) of ten people. Type the following code to the R command line to create this variable.
height = c(176, 154, 138, 196, 132, 176, 181, 169, 150, 175)
Now let’s take bodymass to be a variable that describes the weight (in kg) of the same ten people. Copy and paste the following code to the R command line to create the bodymass variable.
bodymass = c(82, 49, 53, 112, 47, 69, 77, 71, 62, 78)
Both variables are now stored in the R workspace. To view them, enter:
height bodymass
We can now create a simple plot of the two variables as follows:
plot(bodymass, height)
However, this is a rather simple plot and we can embellish it a little. Type the following code into the R workspace:
plot(bodymass, height, pch = 16, cex = 1.3, col = "red", main = "MY FIRST PLOT USING R", xlab = "Body Mass (kg)", ylab = "HEIGHT (cm)")
[Note: R is very picky about the quotation marks you use. If the font that is displaying this post shows the beginning and ending quotation marks as facing in different directions, it won’t work in R. They both have to look the same–just straight lines. You may have to retype them within R rather than cutting and pasting.]
In the above code, the syntax pch = 16 creates solid dots, while cex = 1.3 creates dots that are 1.3 times bigger than the default (where cex = 1). More about these commands later.
Now let’s perform a linear regression on the two variables by adding the following text at the command line:
lm(height~bodymass)
We see that the intercept is 98.0054 and the slope is 0.9528. By the way – lm stands for “linear model”.
Finally, we can add a best fit line to our plot by adding the following text at the command line:
abline(98.0054, 0.9528)
None of this was so difficult!
In Part 3 we will look again at regression and create more sophisticated plots.
About the Author: David Lillis has taught R to many researchers and statisticians. His company, Sigma Statistics and Research Limited, provides both on-line instruction and face-to-face workshops on R, and coding services in R. David holds a doctorate in applied statistics.
See our full R Tutorial Series and other blog posts regarding R programming.