Skip to contents

This page examines a single-factor within-subjects (repeated measures) design using raw data input, focusing on exploratory data analyses.

Preliminary Tasks

Data Entry

This code inputs the variable names and creates a viewable data frame.

Outcome1 <- c(6, 8, 6, 8, 10, 8, 10, 9, 8, 7)
Outcome2 <- c(7, 13, 11, 10, 13, 8, 11, 14, 12, 11)
Outcome3 <- c(9, 16, 11, 12, 15, 13, 9, 14, 11, 10)
RepeatedData <- construct(Outcome1, Outcome2, Outcome3)

Summary Statistics

For reference, this code obtains the boxplot statistics for the data frame.

(RepeatedData) |> describeBoxes()

Boxes for the data

              LW      LH     Mdn      UH      UW
Outcome1   6.000   7.000   8.000   9.000  10.000
Outcome2   7.000  10.000  11.000  13.000  14.000
Outcome3   9.000  10.000  11.500  14.000  16.000

This code obtains the typical descriptive statistics for the data frame.

(RepeatedData) |> describeMoments()

Summary Statistics for the Data

               N       M      SD    Skew    Kurt
Outcome1  10.000   8.000   1.414   0.000  -0.738
Outcome2  10.000  11.000   2.211  -0.617  -0.212
Outcome3  10.000  12.000   2.449   0.340  -1.102

Building Layered Plots

Plotting data points is often a first step in exploring data. Data points obtained from the same individuals are connected.

(RepeatedData) |> plotData(offset = 0, method = "swarm", connect = TRUE)

To make the plots more informative, it is often desirable to layer multiple elements on the same plot. This can be done in a couple of ways.

Using Separate Calls

The typical way to build a plot is to use separate calls for each plotting elements (e.g., data, boxplots) and using the “add” argument to put them on the same plot.

(RepeatedData) |> plotData()
(RepeatedData) |> plotBoxes(add = TRUE)

This can be simplified by using an “add” version of the function call instead of using the longer “add” argument for the function call. Note that additional arguments can be used to alter the plots.

(RepeatedData) |> plotData(main = "Data and Boxplots")
(RepeatedData) |> addBoxes()

Using Passthrough Capabilities

Rather than separate lines for function calls, all plotting elements have passthrough capabilities that allow the them to be placed on the same line. Note that additional arguments can still be used.

(RepeatedData) |> plotData(main = "Data and Boxplots") |> addBoxes(values = FALSE)

As a second example, plot the frequency distributions as histograms and add the summary statistics. The bars represent standard deviations, with dotted lines as the default but solid lines representing the sides with more skew.

(RepeatedData) |> plotFrequencies(main = "Frequencies and Summary Statistics for the Data") |> addMoments()

Common Layered Plots

Some forms of exploratory plots are very common (e.g., violin plots, bean plots, and raincloud plots). Though they could each be built using the methods above, specific functions for these are built into EASI.

Violin Plots

Build violin plots using multiple basic plot calls.

(RepeatedData) |> plotDensity(offset = 0, type = "full", main = "Violin Plots")
(RepeatedData) |> plotBoxes(add = TRUE, values = FALSE)

Obtain violin plots using one call.

(RepeatedData) |> plotViolins()

Bean Plots

Build bean plots using multiple basic plot calls.

(RepeatedData) |> plotDensity(type = "full", offset = 0, main = "Bean Plots")
(RepeatedData) |> plotData(add = TRUE, offset = 0, pch = 95, method = "overplot")

Obtain bean plots using one call.

(RepeatedData) |> plotBeans()

Raincloud Plots

Build raincloud plots using multiple basic plot calls.

(RepeatedData) |> plotDensity(main = "Raincloud Plots", offset = .1)
(RepeatedData) |> plotBoxes(add = TRUE, values = FALSE)
(RepeatedData) |> plotData(add = TRUE, method = "jitter", offset = -.15)

Obtain raincloud plots using one call.

(RepeatedData) |> plotRainclouds()