Introduction

Ten subjects were played tones at each of 5 loudnesses, in random order. Subjects were asked to draw a line on paper whose length matched the loudness of the tone. Each subject repeated each loudness 3 times, for a total of 30 trials per subject. Here is the mean of the 3 log-lengths for each loudness, the sd of the three log-lengths, and the number of replications, which is always 3.

A data frame with 50 observations on the following 5 variables.

Data management

data(Stevens, package="alr4")
library(tidyverse)
library(lme4)
glimpse(Stevens)
Rows: 50
Columns: 5
$ subject  <fct> A, A, A, A, A, B, B, B, B, B, C, C, C, C, C, D, D, D, D, D...
$ loudness <dbl> 50, 60, 70, 80, 90, 50, 60, 70, 80, 90, 50, 60, 70, 80, 90...
$ y        <dbl> 0.379, 1.727, 3.016, 3.924, 4.413, 0.260, 0.833, 2.009, 2....
$ sd       <dbl> 0.507, 0.904, 0.553, 0.363, 0.092, 0.077, 0.287, 0.396, 0....
$ n        <dbl> 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3...

Visualization

ggplot(data=Stevens, aes(x=loudness, y=y)) +
  geom_point(alpha=0.5) +
  stat_smooth(method="lm", formula=y ~ x, se=F) +
  facet_grid(. ~ subject) +
  labs(x="Loudness (in db)",
       y="Mean Line length (in log)") +
  theme_minimal() 

The end