Skip to content

Commit

Permalink
fix : perform PCA only on the original data and apply same transform to
Browse files Browse the repository at this point in the history
original and defaced data instead of running a PCA separately for
defaced and original
  • Loading branch information
celprov committed Sep 30, 2022
1 parent 1ff5907 commit 8f132b6
Show file tree
Hide file tree
Showing 6 changed files with 488 additions and 750 deletions.
1,134 changes: 475 additions & 659 deletions statistical_analysis/IQMs/AnalysisIQMs.ipynb

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions statistical_analysis/IQMs/LoadIQMs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Load IQMs from MRIQC output into a dataframe"""
# # Load IQMs from MRIQC output into a dataframe

import os
import json
Expand Down Expand Up @@ -94,6 +94,6 @@ def get_key(my_dict,val):

iqms_df = pd.DataFrame(np.hstack((i_merge,site)), columns = ['subject'] + iqms_keys + ['defaced'] + ['site'])

# Repeated measure MANOVA is only implemented in R
# Repeated-measures MANOVA is only implemented in R
# Thus we save the dataframe so we can load it in R
iqms_df.to_csv('iqms_df.csv')
2 changes: 1 addition & 1 deletion statistical_analysis/ManualRatings/ANOVA.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@
"id": "354ce05a",
"metadata": {},
"source": [
"For the assumption of sphericity to be verified, the test should not reject the null hypothesis, which is that the variance between group is equal. The assumption is violated by the interaction defaced:rater, thus anova_test can apply automatically sphericity correction"
"For the assumption of sphericity to be verified, the test should not reject the null hypothesis, which is that the variance between group is equal. If any assumption is violated, we will switch to the alternative analysis using linear mixed-effects models."
]
},
{
Expand Down
80 changes: 0 additions & 80 deletions statistical_analysis/ManualRatings/LinearMixedEffectsModels.ipynb

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions statistical_analysis/ManualRatings/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@
## Statistical analysis associated to the defacing pre-registration.

Manual ratings
- `simulate_data.R` is a script to simulate raters manually assigning quality grades to subjects in original and defaced conditions. The simulated data have a positive bias towards defaced ratings.


- `VisualizeRatings.ipnyb` is a notebook to visualize the distributions of ratings in the defaced vs original conditions.


- `ANOVA.ipynb` is the notebook to run repeated-measures ANOVA and check its assumptions.
- In `VaryDatasetParameters_ANOVA.ipynb` I performed a sensitivity analysis to verify how many ratings do we need for the model to detect a significant effect of defacing.


- `LinearMixedEffectModels.ipynb` is the alternative notebook we will use in case one of the assumption of the repeated-measures ANOVA is violated.


- `VisualizeRatings.ipnyb` is a notebook to visualize the distributions of ratings in the defaced vs original conditions.


- `simulate_data.R` is a script to simulate raters manually assigning quality grades to subjects in original and defaced conditions. The simulated data have a positive bias towards defaced ratings.
<!-- #endregion -->
8 changes: 4 additions & 4 deletions statistical_analysis/ManualRatings/VisualizeRatings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"outputs": [],
"source": [
"## Simulate data with bias\n",
"n_rated <- 580\n",
"n_sub <- 580 #nbr of subjects available in the dataset\n",
"n_rated <- 185\n",
"n_sub <- 185 #nbr of subjects available in the dataset\n",
"n_rater <- 4 #nbr of raters\n",
"perc_biased <- c(2,10,60,90) #4 raters + bias\n",
"file_name=\"SimulatedData/SimulatedDefacedRatings_4raters_bias.Rda\"\n",
Expand Down Expand Up @@ -298,8 +298,8 @@
"outputs": [],
"source": [
"## Simulate continuous data with bias\n",
"n_rated <- 580\n",
"n_sub <- 580 #nbr of subjects available in the dataset\n",
"n_rated <- 185\n",
"n_sub <- 185 #nbr of subjects available in the dataset\n",
"n_rater <- 4 #nbr of raters\n",
"perc_biased <- c(2,10,60,90) #4 raters + bias\n",
"ratings_range <- seq(0,1,length.out=11)\n",
Expand Down

0 comments on commit 8f132b6

Please sign in to comment.