poldracklab / fitlins

Fit Linear Models to BIDS Datasets
https://fitlins.readthedocs.io
Apache License 2.0
73 stars 30 forks source link

Group level correlations + regression #128

Open mgxd opened 5 years ago

mgxd commented 5 years ago

Regarding variables from participants.tsv or within phenotype/:

1) Add as regressor(s) to existing contrasts 2) Correlate variable(s) with existing contrasts

effigies commented 5 years ago

@tyarkoni We need some advice on how to write models.

The variables should be available, so I don't think that's an issue, it's just a question of how to do something besides a simple t-contrast past the run level.

@mgxd Can you post your model where you attempted this? I concrete example will save a lot of time.

satra commented 5 years ago

@tyarkoni - we would like to do a couple of things to both prod fitlins along, but also to get some science done :)

for our specific use case at the moment, we may have one or more runs per tasks, a generous assortment of either run level (e.g., speech production intensity) or participant level (e.g., BDI, age, sex) variables.

we would like to write models that can:

  1. incorporate run level components (run level model) orth speech intensity against trial_type

  2. simple group model [Age, Sex, BDI]

  3. do multiple regression at the group level based on some transformation that determines whether a participant belongs to group A or group B. e.g. if BDI score > threhsold then group A else group B

and then use these groups into a model which may have the following columns: [Group A, Group B, Age, Sex]

satra commented 5 years ago

@tyarkoni - just to add, i think the above models cover 80% of all use cases in neuroimaging. and since multiple regression can be made equivalent to an ANOVA, even all those models.

this FSL user guide covers many of these common analyses: https://fsl.fmrib.ox.ac.uk/fsl/fslwiki/FEAT/UserGuide#Group_Statistics

effigies commented 5 years ago

While we're at it, if y'all know how to write a useful F test, and we can wrangle it into a model, we can start to support those.

satra commented 5 years ago

an F test is simple a matrix on a set of lower level contrasts. for an example see this:

https://github.com/nipy/nipype/blob/master/examples/fmri_spm_face.py#L283

mgxd commented 5 years ago

Sure- here's the model.

{
  "Name": "test-sparse",
  "Input": {
    "Task": "emosent",
    "Subject": [
      "voice968",
      "voice969"
    ]
  },
  "Description": "Model speech with sparse acquisition",
  "Steps": [
    {
      "Level": "run",
      "Transformations": [
        {
          "Name": "Factor",
          "Input": ["trial_type"]
        },
        {
          "Name": "Or",
          "Input": [
            "trial_type.sad",
            "trial_type.neutral",
            "trial_type.happy"
          ],
          "Output": "speech"
        },
        {
          "Name": "Convolve",
          "Input": ["speech"],
          "Model": "spm"
        }
      ],
      "Model": {
        "X": ["speech"],
        "Confounds": [
          "FramewiseDisplacement",
          "X",
          "Y",
          "Z",
          "RotX",
          "RotY",
          "RotZ"
        ]
      },
      "Contrasts": [
        {
          "Name": "speech_gt_baseline",
          "ConditionList": ["speech"],
          "Weights": [1],
          "Type": "t"
        }
      ]
    },
    {
      "Name": "participant",
      "Level": "subject",
      "autoContrasts": ["speech_gt_baseline"]
    },
    {
      "Name": "Dataset",
      "Level": "dataset",
      "Model": {
        "X": ["bdi"]
      },
      "Contrasts": [
        {
          "Name": "bdi_all",
          "ConditionList": ["bdi"],
          "Weights": [1],
          "Type": "t"
        }
      ],
      "autoContrasts": ["speech_gt_baseline"]
    }
  ]
}
effigies commented 5 years ago

@tyarkoni Just a bump in case this got buried in your notifications.