Question 1
The data contained in smokers.csv reports the findings of Spilich, June, and Renner (1992), who asked nonsmokers (NS), smokers who had delayed smoking for three hours (DS), and smokers who were actively smoking (AS) to perform a pattern recognition task in which they had to locate a target on a screen. The dependent variable was latency (in seconds).
Plot the means and 95% confidence intervals of the smokers.csv data.
Display a data frame that shows the group means, as well as the lower and upper boundaries of the confidence intervals. Do not display any other statistics in the data frame.
Question 2
Looking at the plot, what is a potential concern for the smokers.csv data?
Question 3
Without using the lm() or aov() function, compute an omnibus F-test. Is there support for the hypothesis that smoking has an effect on performance? Report the:
- F-statistic
- Degrees of freedom
- P-value
Question 4
Report an effect size in terms of for the test you ran in the previous question. You should obtain a negative result. What do you think this means in plain English? (You wont lose marks if you are incorrect.)
Question 5
Run an ANOVA with planned contrasts that:
- compares the combined effect of the active smokers and delayed smokers to the non-smokers, and
- compares the active smokers with the delayed smokers.
Report the test statistic, degrees of freedom, and p-value for those two comparisons. You ARE allowed to use the functions lm() and aov().
Question 6
Report an effect size in terms of a partial correlation for each of the contrasts you conducted in the previous question.
Question 7
Recall that there is a version of the t-test called a Welchs t-test that is robust to unequal variances. The Welch procedure can actually be extended to One-Way ANOVAs using the function oneway.test().
Use your excellent sleuthing skills to figure out how to use this function and display its results (Omnibus F-statistic, degrees of freedom, and p-value) for a One-Way analysis of variance that doesnt assume equal variances on the smokers.csv data. Does your interpretation of this ANOVA change from the first one you ran?
Question 8
Write some R code that re-creates the following matrix:
[,1] [,2] [,3]
[1,] 78 85 92
[2,] 81 79 88
Display the matrix and use the is.matrix() function to prove it is a matrix.
Note: We never learned how to do this in class, so you need to figure it out on your own.
Question 9
From the previous question, apply the transpose function t() to the matrix. In plain English, what has this function done specifically?
Question 10
Create the following two matrices:
Matrix A:
[,1] [,2]
[1,] 1 3
[2,] 2 4
Matrix B:
[,1] [,2]
[1,] 5 7
[2,] 6 8
Multiply them like this: A * B and then write out how each value in the matrix was calculated.
Example:
- [1,1] = … = 5
- [2,1] = … = 12
- [1,2] = … = 21
- [2,2] = … = 32
(Replace the … with the calculation that was performed.)
Question 11
Repeat the previous question, but this time multiply them like this: A %*% B.
Question 12
Write some (efficient) R code to re-create the following multiplication table:
[,1] [,2] ... [,12]
[1,] 1 2 ... 12
[2,] 2 4 ... 24
...
[12,] 12 24 ... 144