Ch. 6 | Exercise 1

Chapter 6 | Exercise 1

Make a scatter plot and add a regression line of log-transformed frequencies (add 1 to the scores to avoid –Infinity) and mean reaction times in the data set ldt. What is the relationship between the variables? Remove the outliers with reaction times greater than 1200 ms and repeat the procedure. What has changed?

Load the package and the data:

> library(Rling) > data(ldt)

Make a scatter plot and add a regression line:

> plot(ldt$Mean_RT ~ log1p(ldt$Freq)) > m <- lm(ldt$Mean_RT ~ log1p(ldt$Freq)) > abline(m)

The relationship is inverse (the higher the frequencies, the lower the reaction times).

> ldt1 <- ldt[ldt$Mean_RT < 1200, ] > m1 <- lm(ldt1$Mean_RT ~ log1p(ldt1$Freq)) > abline(m1, lty = 2)

The slope of the new regression line is slightly less steep.