Homework 7

Psychology 2812B FW23


Weekly homework assignments are comprised of two components: a Lab Component that your TA will guide you through in the weekly lab session, and a Home Component that you are to complete on your own. You must hand in both components. Both will count towards your grade.

Submit homework on OWL by 5:00 pm London ON time on the date shown in the Class Schedule.

Submit your homework assignment as a single RMarkdown file, using your last name and the homework assignment as a filename in the following format: gribble_n.Rmd where n is the homework assignment number.

Here is the R Markdown template file for this assignment: lastname_7.Rmd.


Lab Component

Like in the previous homework, we will again look at a dataset (from https://pnb.mcmaster.ca/bennett/psy710) in which a dependent variable called “score” was measured in 4 groups of participants. Let’s pretend that score is each participant’s score on a memory test and condition is four different drugs they ingested prior to the memory test. We want to know if the drugs affect memory.

Load the view the dataset:

library(tidyverse)
load(file=url('https://www.gribblelab.org/2812/data/theAOVdataRL3.rda'))
glimpse(theAOVdata)
Rows: 80
Columns: 2
$ condition <fct> c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, c1, …
$ score     <dbl> 72.48003, 112.72329, 91.63106, 93.61600, 92.07769, 112.93725…
  1. Fit the ANOVA model to the data
            Df Sum Sq Mean Sq F value Pr(>F)  
condition    3   3226  1075.2   3.832  0.013 *
Residuals   76  21328   280.6                 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  1. Conduct post-hoc tests to determine which groups are different from each other. Use the Bonferroni correction to adjust for multiple comparisons.

    Pairwise comparisons using t tests with pooled SD 

data:  score and condition 

   c1   c2   c3  
c2 1.00 -    -   
c3 0.22 0.01 -   
c4 1.00 0.24 1.00

P value adjustment method: bonferroni 
  1. Interpret the tests—which groups are different from each other? What do the p-values mean?

Home Component

  1. Again conduct post-hoc tests to determine which groups are different from each other, but this time use the Bonferroni-Holm correction to adjust for multiple comparisons.

    Pairwise comparisons using t tests with pooled SD 

data:  score and condition 

   c1   c2   c3  
c2 0.77 -    -   
c3 0.18 0.01 -   
c4 0.77 0.18 0.77

P value adjustment method: holm 
  1. Interpret the tests—which groups are different from each other? What do the p-values mean?

  2. You are planning a new experiment that will involve 6 groups of participants. Your task is to estimate the sample size that you will need for each group in order to detect a difference in the mean of a dependent variable with a power of 0.80. You plan to adopt an alpha level of 0.05 for rejecting the null hypothesis. Based on pilot studies and other similar studies reported in the literature, you estimate that the within-group variance will be 5 times larger than the between-groups variance. Use power.anova.test() to estimate the sample size needed for each group. Round up to the nearest whole number.

  1. Let’s say you go ahead and run the experiment described above in Q6.

    1. Define Type-I error
    2. If the null hypothesis is true and there actually isn’t a difference in the mean of the dependent variable across groups in the population, what is the probability that you will make a Type-I error?
    3. What could you do to reduce the probability of making a Type-I error?
    4. Define Type-II error
    5. If the null hypothesis is false and there actually is a difference in the mean of the dependent variable across groups in the population, what is the probability that you will make a Type-II error?
    6. What could you do to reduce the probability of making a Type-II error?