Despicable Me group-level analysis

Code
knitr::opts_chunk$set(echo = TRUE, eval=TRUE)
Sys.setenv("FSLDIR" = "/Users/vandeks/fsl")
Sys.setenv("FSLOUTPUTTYPE" = "NIFTI_GZ")
templatefile='/Users/vandeks/fsl/data/standard/MNI152_T1_2mm_brain.nii.gz'

Introduction

We will perform a group-level analysis of the Despicable Me task.

Setup

Code
sites = read.csv('/Users/vandeks/Library/CloudStorage/Box-Box/SMN/3first-level_analysis/homework/first-level_analysis/subject_assignment.csv')
sites = sites[ ! sites$student %in% c('Yisu', 'Shuai', 'Laura') & !is.na(sites$student),]
# list available feat directories
feats = sapply(strsplit(system("ls -d /Users/vandeks/Library/CloudStorage/Box-Box/SMN/data/RBC/HBN_BIDS/*/*/func/*bold.feat", intern = TRUE), "/"), function(x) x[[11]])
suppressWarnings(feats <- sapply(sites$subject, function(x)
  system(
    paste0("ls -d /Users/vandeks/Library/CloudStorage/Box-Box/SMN/data/RBC/HBN_BIDS/", x, "/*/func/*bold.feat 2>/dev/null"),
    intern = TRUE) ))
feats = unlist(feats)
sites$feat = NA
sites$feat[ match(names(feats), sites$subject)] = feats
# A lot of motion artifact in their T1 image, so exclude them.
regExclude = c('NDARAU939WUK', 'NDARAM675UR8', 'NDARAN262WK6', 'NDARAN814UPR', 'NDARAK738BGC', 'NDARAH948UF0')
regExclude
[1] "NDARAU939WUK" "NDARAM675UR8" "NDARAN262WK6" "NDARAN814UPR" "NDARAK738BGC"
[6] "NDARAH948UF0"

Merge in demographic variables

For the group-level analyses, we are going to look at how some demographic features are associated with BOLD response during the task.

  • Merge in the demographic variables. They are located here data/RBC/HBN_BIDS/study-HBN_desc-participants.tsv in tab delimited format.

Motion and Registration QC

The motion files are included in the feat directories in the file mc/prefiltered_func_data_mcf_rel_mean.rms.

  • Add them to the sites data frame and create a plot to decide on a threshold for exclusion using either 0.5mm.
  • Create a Table 1 with the age, site, and motion, with sex as the columns.
  • Registration mostly looked good across all participants. One student noted a T1 image with serious motion artifact, so exclude that too.
  • Some people are missing motion files or the mask, probably because FEAT failed to run. Normally, you would debug that. Because we have limited time, we will exclude them for this analysis.

Hint: You should have 51 participants total included in the data after making exclusions.

Registration to the template space

I already registered all of the images to the MNI template and put the output in the participant feat directories in the stats_reg folder.

Study-level mask

  • Create an “overlap” image that shows the proportion of participants with data at each voxel based on the mask in their FEAT folder. Visualize the overlap image here with the MNI in the background.
  • Create a study-level mask that includes voxels with 100% of data (i.e. every participant has data).
  • Write a one-sentence comment on how the coverage looks.

Group level model

FSL FLAME

Fit a FLAME model with the following design: \[ Y_i(v) = \beta_0(v) + \beta_1(v)*\text{age}_i + \beta_3(v)*\text{motion}_i, \]

where \(Y_i\) the the “cope” file for the difference between positive and negative emotional states. For age, use the centered age (subtract the mean age from each participant’s age).

For the group level contrasts, create one:

  1. The mean effect across all participants.
  • Describe the interpretation of the effect.

Hint: For the FLAME model, you can use the flameo function. You will need to pass the varcope images in addition to the cope images. The varcope images are also located in the feat directories.

pbj package

  • Use the pbj package to fit the same model for the age and intercept effects. Hint: to test the intercept effect you need to fit a model formula without the intercept.

Visualizations

  • Threshold the statistical images for the overall mean (Intercept) effect showing positive and negative regions at \(Z\ge 2.32\) and create an image here with a few slice for the two models (FLAME, pbj) that shows some of the difference between the intercept term side-by-side.
  • In 1-2 sentences, explain the interpretation of the effects (i.e. negative versus positive values).

Cluster extent inference

easythresh

  • Use the easythresh function from FSL to perform cluster extent inference (CEI) for the intercept term of the FLAME output. Use a cluster-forming threshold of 2.32.
  • Use the easythresh function to perform cluster extent inference for the intercept term of the pbj output with a cluster-forming threshold of 2.32.
  • Create a cluster table for the results and compare the output.
  • What aspects are different and why? Things that can be different include:
    • The Z-statistic image has different values.
    • The clusters are different sizes. Why would they be?
    • The CEI \(p\)-values are different. Why would they be?

pbj

This will take a little while longer to run because it is using bootstraps to compute \(p\)-values.

  • Use the pbj package to perform spatial extent inference for the intercept term. Use a cluster-forming threshold of \(Z \ge 2.32\). Run it with 1000 bootstrap samples.
  • Create a cluster table for the results.
  • Merge in the \(p\)-values from the easythresh results.
  • Show the first 10 rows of the table here.
  • In 1-3 sentences, describe what things are different and why?

Reporting task effect differences

For this section, report the results from the pbj analysis (you can choose which one) for the intercept term.

Methods

Describe the methods you used to analyze the results 1-2 paragraphs including a description of the first-level analysis and group-level analysis. It should be described well enough that someone could repeat your analyses starting from the first-level analysis.

Results

Describe the results of your analyses in one paragraph, including a final figure showing the significant clusters from the spatial extent inference for the overall mean (Intercept) effect. Include a table with the cluster information. You should interpret the location of the result and why you think it is relevant to the task and the contrast.