Box Plots with Two Factors (Stratified Boxplots) in R | R Tutorial 2.3 | MarinStatsLectures

MarinStatsLectures-R Programming & Statistics
MarinStatsLectures-R Programming & Statistics
140.3 هزار بار بازدید - 9 سال پیش - Box Plots with Two Factors
Box Plots with Two Factors (Stratified Boxplots) in R: How to create and modify side by side boxplots comparing groups that are stratified using a third variable (Multiple X Variables) in R; Find the Free Dataset (LungCapData) Here (https://goo.gl/tJj5XG)

Need More Statistics & R Programming Videos: (https://goo.gl/4vDQzT)


►► Like to support us? You can Donate (https://bit.ly/2CWxnP2), Share our Videos, Leave us a Comment and Give us a Thumbs up! Either way We Thank You!


In this R video tutorial, we will learn how to create side by side boxplots comparing groups that are stratified using a third variable. In this tutorial we will also learn to enhance the plots by adding titles, changing axes labels, adding legends and changing colours of the plots. We will also see how to use the "*" to stratify the box plots and the "las" argument.  


In descriptive statistics, a box plot or boxplot is a method for graphically summarizing the distribution of a numerical (quantitative or continuous) variable through its quartiles, minimum, maximum, and outliers. The “box” portion of the plot visually displays the first quartile, median, and third quartile.  The “whiskers” or lines that extend from the box display the minimum and maximum value that are not considered to be outliers.


Box plots for two factors are a way of comparing the distribution for a numeric (quantitative or continuous) variable, stratified based on 2 factors.  For example, we may wish to compare the distribution of body temperature (Y) for males and females (X1), as well as young and old (X2).  Here, the “Body Temperature” would be the “Y” variable, “Biological Sex” would be the first factor or “X1”, and “Categorized Age (young/old)” would be the second factor or “X2”.  Here, a desirable visual display would be to have a boxplot of body temperature for young males, next to a boxplot of body temperature for young females, next to a boxplot of body temperature for old males, next to a boxplot of body temperature for old females.  It may also be desirable to have the plot colour coded, to have the male boxplots appear in one color, and the female boxplots to appear in a different color.  In this video we show how to make such a plot in R.


These video tutorials are useful for anyone interested in learning data science and statistics with R programming language using RStudio.


Table of Content:

0:00:06 When to use Stratified (Side by Side) Box Plots
0:00:17 Introducing the example and data that is used in this video
0:01:15 How to make a boxplot for a single variable
0:01:22 How to modify the appearance of a box plot to visually represent our data better (by adding title, relabeling axes, and more)
0:01:44 How to make side-by-side boxplots to compare groups using ~ (tilda)
0:02:22 A brief introduction to confound effect
0:02:54 How to create a boxplot for a subset of data using square brackets
0:03:40 How to create boxplots comparing groups that are stratified by Age (a third variable)
0:05:09 How to modify the stratified boxplot to visually present our data better (e.g. adding title, relabeling x and y axes, adding legends and more)
0:06:02 How to add colours to help separate the groups in our boxplot

► ► Watch More:

► Intro to Statistics Course: https://bit.ly/2SQOxDH
►Data Science with R https://bit.ly/1A1Pixc
►Getting Started with R (Series 1): https://bit.ly/2PkTneg
►Graphs and Descriptive Statistics in R (Series 2): https://bit.ly/2PkTneg
►Probability distributions in R (Series 3): https://bit.ly/2AT3wpI
►Bivariate analysis in R (Series 4): https://bit.ly/2SXvcRi
►Linear Regression in R (Series 5): https://bit.ly/1iytAtm
►ANOVA Concept and with R https://bit.ly/2zBwjgL
►Hypothesis Testing: https://bit.ly/2Ff3J9e
►Linear Regression Concept and with R Lectures https://bit.ly/2z8fXg1

Follow MarinStatsLectures

Subscribe: https://goo.gl/4vDQzT
website: https://statslectures.com
Facebook:https://goo.gl/qYQavS
Twitter:https://goo.gl/393AQG
Instagram: https://goo.gl/fdPiDn

Our Team:
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer and Creative Manager: Ladan Hamadani (B.Sc., BA., MPH)


These videos are created by #marinstatslectures to support some courses at The University of British Columbia (UBC) (#IntroductoryStatistics and #RVideoTutorials for Health Science Research), although we make all videos available to the everyone everywhere for free.

Thanks for watching! Have fun and remember that statistics is almost as beautiful as a unicorn!
9 سال پیش در تاریخ 1394/10/14 منتشر شده است.
140,398 بـار بازدید شده
... بیشتر