1
What is the correlation between log lexical decision time and log frequency-per-million-in-CELEX?

library(languageR)
cor(english$RTlexdec,english$WrittenFrequency)
## [1] -0.434815

The correlation is -0.434815.

2
Is log lexical decision time approximately normally distributed? To help decide, make a density plot (density()) and use curve(dnorm(x, mean = …, sd= …), add=TRUE) to overlay a normal approximation computed using the sample mean and standard deviation.

plot(density(english$RTlexdec),main="Lexical Decision Reaction Time")
curve(dnorm(x,mean=mean(english$RTlexdec),sd=sd(english$RTlexdec)),add=TRUE,col="red")

The lexical decision time is approximately normally distributed.

3
Are log lexical decision times approximately normally distributed for each subset? Impressionistically, how does the approximation compare for each subset to that of the combined data set?

old = subset(english, AgeSubject == 'old')
young = subset(english, AgeSubject == 'young')
par(mfrow=c(1,2))
plot(density(old$RTlexdec),main="LDRT (Old)",col="red")
curve(dnorm(x,mean=mean(old$RTlexdec),sd=sd(old$RTlexdec)),add=TRUE)
plot(density(young$RTlexdec),col="blue",main="LDRT (Young)")
curve(dnorm(x,mean=mean(young$RTlexdec),sd=sd(young$RTlexdec)),add=TRUE)

par(mfrow=c(1,1))

It appears that the lexical decision times are more normally distributed for the young dataset than for the old dataset.

4
What are the sample mean and standard deviation of rt.diff? Plot its kernel density and overlap a normal approximation. How good is the normal approximation?

rt.diff = old$RTlexdec - young$RTlexdec
mean(rt.diff)
## [1] 0.2217215
sd(rt.diff)
## [1] 0.091446
plot(density(rt.diff),main="Lexical Decision Reaction Time",col="red")
curve(dnorm(x,mean=mean(rt.diff),sd=sd(rt.diff)),add=TRUE)

The density curve of rt.diff is the most normally distributed of all the curves plotted thus far.

5
Compute a 95% frequentist confidence interval for the difference in mean RTs between the two groups using (a) bootstrapping, and (b) a t-test. (Use ?t.test to get information on the latter.)

resample = function(i) {
  resampled.data = sample(rt.diff, size=length(rt.diff), replace=TRUE)  
  resampled.parameter.estimate = mean(resampled.data) # maximum likelihood estimate
  return(resampled.parameter.estimate)
}
many.resampled.estimates = sapply(1:1000, FUN=resample)
est.CI = quantile(many.resampled.estimates, probs=c(.025, .975))
est.CI
##      2.5%     97.5% 
## 0.2182067 0.2255523
t.test(old$RTlexdec,young$RTlexdec)
## 
##  Welch Two Sample t-test
## 
## data:  old$RTlexdec and young$RTlexdec
## t = 67.4682, df = 4534.555, p-value < 2.2e-16
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  0.2152787 0.2281642
## sample estimates:
## mean of x mean of y 
##  6.660958  6.439237

6
How do the two confidence intervals compare? Suppose that the distribution were not approximately normal - which should you prefer?
The bootstrapping 95% confidence interval is narrower than the t-test 95% confidence interval. Since the t-test assumes a normal distribution, if our distribution were not approximately normal, we should prefer the bootstrapping method for finding the 95% confidence interval.

7
What is the p-value of the difference? Is the difference “statistically significant”? In plain English, what does this mean, in terms of the confidence intervals and the meaning of frequentist CIs?
The p-value of the difference is less than 2.2e-16. This is “statistically significant”. This t-test p-value tells us that the two datasets, young and old, are consistently different from one another. The frequentist CIs tell us with 95% confidence that the mean difference between the two datasets is between 0.2152787 and 0.2281642.