For this exercise, please try to reproduce the results from Experiment 1 of the associated paper (Ko, Sadler & Galinsky, 2015). The PDF of the paper is included in the same folder as this Rmd file.

Methods summary:

A sense of power has often been tied to how we perceive each other’s voice. Social hierarchy is embedded into the structure of society and provides a metric by which others relate to one another. In 1956, the Brunswik Lens Model was introduced to examine how vocal cues might influence hierarchy. In “The Sound of Power: Conveying and Detecting Hierarchical Rank Through Voice,” Ko and colleagues investigated how manipulation of hierarchal rank within a situation might impact vocal acoustic cues. Using the Brunswik Model, six acoustic metrics were utilized (pitch mean & variability, loudness mean & variability, and resonance mean & variability) to isolate a potential contribution between individuals of different hierarchal rank. In the first experiment, Ko, Sadler & Galinsky examined the vocal acoustic cues of individuals before and after being assigned a hierarchal rank in a sample of 161 subjects (80 male). Each of the six hierarchy acoustic cues were analyzed with a 2 (high vs. low rank condition) x 2 (male vs. female) analysis of covariance, controlling for the baseline of the respective acoustic cue.


Target outcomes:

Below is the specific result you will attempt to reproduce (quoted directly from the results section of Experiment 1):

The impact of hierarchical rank on speakers’ acoustic cues. Each of the six hierarchy-based (i.e., postmanipulation) acoustic variables was submitted to a 2 (condition: high rank, low rank) × 2 (speaker’s sex: female, male) between-subjects analysis of covariance, controlling for the corresponding baseline acoustic variable. Table 4 presents the adjusted means by condition. Condition had a significant effect on pitch, pitch variability, and loudness variability. Speakers’ voices in the high-rank condition had higher pitch, F(1, 156) = 4.48, p < .05; were more variable in loudness, F(1, 156) = 4.66, p < .05; and were more monotone (i.e., less variable in pitch), F(1, 156) = 4.73, p < .05, compared with speakers’ voices in the low-rank condition (all other Fs < 1; see the Supplemental Material for additional analyses of covariance involving pitch and loudness). (from Ko et al., 2015, p. 6; emphasis added)

The adjusted means for these analyses are reported in Table 4 (Table4_AdjustedMeans.png, included in the same folder as this Rmd file).


Step 1: Load packages

library(tidyverse) # for data munging
library(knitr) # for kable table formating
library(haven) # import and export 'SPSS', 'Stata' and 'SAS' Files
library(readxl) # import excel files

# #optional packages:
library(psych)
library(car) # for ANCOVA
library(compute.es) # for ANCOVA
library(lsmeans) # for ANCOVA
library(effectsize) # for effect sizes

Step 2: Load data

# Just Experiment 1
d <-read_csv("data/S1_voice_level_Final.csv")
# DT::datatable(d)

Step 3: Tidy data

df <- d %>%
  select(voice, plev, vsex, sex,
         starts_with("pitch"), 
         starts_with("intense"), 
         starts_with("form"))

Step 4: Run analysis

Pre-processing

CUES <- c("pitch", "intense", "form")
TYPES <-  c("mean", "var")
RANKS <- c("low", "high")

keyname <- function(cue, type) {
  # Turn condition cue and type into keyname for list storage
  return(sprintf("%s_%s", cue, type))
}

kn_rename <- function(keyname) {
  # rename keynames for pretty printing
  t <- gsub("pitch", "Pitch", keyname)
  t <- gsub("intense", "Loudness", t)
  t <- gsub("form", "Resonance", t)
  t <- gsub("_mean", " (Mean)", t)
  t <- gsub("_var", " (Variability)", t)
  return(t)
}

models <- list()
ancovas <- list()
for (cue in CUES) {
  for (type in TYPES) {
    
    model <- lm(formula = sprintf("%s_s%s ~ %s_r%s + plev * vsex", cue, type, cue, type), data = df)
    ancova <- car::Anova(model, type = "III")
    
    kn <- keyname(cue, type)
    models[[kn]] <- model
    ancovas[[kn]] <- ancova
    
  }
}

Descriptive statistics

In the paper, the adjusted means by condition are reported (see Table 4, or Table4_AdjustedMeans.png, included in the same folder as this Rmd file). Reproduce these values below:

LINEBREAK <- "\n----------------------------------------------\n"

print_descriptive_stats <- function() {
  out <- sprintf("Total number of participants: %d", nrow(df))
  out <- paste0(out, sprintf("\nNumber of male participants: %d", nrow(filter(df, sex == "M"))))
  out <- paste0(out, sprintf("\nNumber of female participants: %d", nrow(filter(df, sex == "F"))))
  out <- paste0(out, LINEBREAK)
  cat(out)
}

print_condition_mean_stats <- function(kn) {
  
  condition_name <- kn_rename(kn)
  model <- models[[kn]]
  ancova <- ancovas[[kn]]
  
  adjusted_means <- emmeans::emmeans(model, sprintf("%s_r%s", cue, type), by = "plev", data = df)
  effect_size <- suppressMessages(effectsize::eta_squared(ancova, partial = TRUE)$Eta2_partial[2])
  
  high_adjusted_mean <- summary(adjusted_means)$emmean[2]
  low_adjusted_mean <- summary(adjusted_means)$emmean[1]

  out <- condition_name
  out <- paste0(out, sprintf("\nAdjusted mean (high-rank condition): %.2f", high_adjusted_mean))
  out <- paste0(out, sprintf("\nAdjusted mean (low-rank condition): %.2f", low_adjusted_mean))
  out <- paste0(out, sprintf("\nEffect size: %.2f", effect_size))
  out <- paste0(out, LINEBREAK)
  
  cat(out)
  
}

print_descriptive_stats()
## Total number of participants: 161
## Number of male participants: 80
## Number of female participants: 81
## ----------------------------------------------
for (cue in CUES) {
  for (type in TYPES) {
    
    kn <- keyname(cue, type)
    print_condition_mean_stats(kn)
    
  }
}
## Pitch (Mean)
## Adjusted mean (high-rank condition): 158.61
## Adjusted mean (low-rank condition): 155.52
## Effect size: 0.03
## ----------------------------------------------
## Pitch (Variability)
## Adjusted mean (high-rank condition): 1425.02
## Adjusted mean (low-rank condition): 1648.37
## Effect size: 0.03
## ----------------------------------------------
## Loudness (Mean)
## Adjusted mean (high-rank condition): 59.34
## Adjusted mean (low-rank condition): 58.67
## Effect size: 0.01
## ----------------------------------------------
## Loudness (Variability)
## Adjusted mean (high-rank condition): 196.73
## Adjusted mean (low-rank condition): 183.48
## Effect size: 0.03
## ----------------------------------------------
## Resonance (Mean)
## Adjusted mean (high-rank condition): 1129.38
## Adjusted mean (low-rank condition): 1128.81
## Effect size: 0.00
## ----------------------------------------------
## Resonance (Variability)
## Adjusted mean (high-rank condition): 42170.78
## Adjusted mean (low-rank condition): 43654.54
## Effect size: 0.00
## ----------------------------------------------

Inferential statistics

The impact of hierarchical rank on speakers’ acoustic cues. Each of the six hierarchy-based (i.e., postmanipulation) acoustic variables was submitted to a 2 (condition: high rank, low rank) × 2 (speaker’s sex: female, male) between-subjects analysis of covariance, controlling for the corresponding baseline acoustic variable. […] Condition had a significant effect on pitch, pitch variability, and loudness variability. Speakers’ voices in the high-rank condition had higher pitch, F(1, 156) = 4.48, p < .05; were more variable in loudness, F(1, 156) = 4.66, p < .05; and were more monotone (i.e., less variable in pitch), F(1, 156) = 4.73, p < .05, compared with speakers’ voices in the low-rank condition (all other Fs < 1; see the Supplemental Material for additional analyses of covariance involving pitch and loudness).

print_ancova_results <- function(kn) {
  
  condition_name <- kn_rename(kn)
  ancova <- ancovas[[kn]]
  
  df1 <- ancova[3,2]
  df2 <- ancova[6,2]
  
  F_stat <- ancova[3,3]
  p_stat <- ancova[3,4]
  
  cat(paste0(sprintf("%s\nF(%d, %d) = %.2f p = %.3f%s", condition_name, df1, df2, F_stat, p_stat, LINEBREAK)))
}

for (cue in CUES) {
  for (type in TYPES) {
    
    kn <- keyname(cue, type)
    print_ancova_results(kn)
    
  }
}
## Pitch (Mean)
## F(1, 156) = 4.48 p = 0.036
## ----------------------------------------------
## Pitch (Variability)
## F(1, 156) = 4.73 p = 0.031
## ----------------------------------------------
## Loudness (Mean)
## F(1, 156) = 2.21 p = 0.139
## ----------------------------------------------
## Loudness (Variability)
## F(1, 156) = 4.66 p = 0.032
## ----------------------------------------------
## Resonance (Mean)
## F(1, 156) = 0.00 p = 0.965
## ----------------------------------------------
## Resonance (Variability)
## F(1, 156) = 0.47 p = 0.494
## ----------------------------------------------

Step 5: Reflection

Were you able to reproduce the results you attempted to reproduce? If not, what part(s) were you unable to reproduce?

Yes

How difficult was it to reproduce your results?

Not very but also this was pretty unpleasant to reproduce

What aspects made it difficult? What aspects made it easy?

Again, would have been nice to get some sort of README or other documentation to make the reproduction process a bit smoother. Hard to tell what the column names are with one pass