FitLins Example Models¶
This is a collection of example models, written for OpenNeuro (formerly OpenFMRI) datasets.
Statistical models, described in the draft BIDS Stats-Models specification, fit into the BIDS data structure with the following naming convention:
<bids_root>/models/model-<label>_[desc-<description>]_smdl.json
FitLins accepts models that are present in a BIDS directory or are passed with the
-m
/--model
flag.
These models may be browsed in the examples directory on GitHub.
Word vs Pseudoword Contrast¶
Dataset: https://openneuro.org/datasets/ds000003/versions/00001
This model is translated from model001 in the original OpenFMRI dataset.
It demonstrates using the Factor
transform to turn the trial_type
column into a column for each trial type (i.e., the trial_type.word
column has 1
where trial_type
was word
, 0
elsewhere, and so
on), as well as convolution.
The Model.X
section demonstrates selection of regressors for the design
matrix, and Contrasts
shows how to perform a simple contrast between
two conditions.
At the dataset
level, the DummyContrasts
option demonstrates taking
a simple mean at the group level.
ds000003/models/model-001_smdl.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | {
"Name": "ds003_model001",
"Description": "",
"Input": {
"task": "rhymejudgment"
},
"Steps": [
{
"Level": "run",
"Transformations": [
{
"Name": "Factor",
"Input": [
"trial_type"
]
},
{
"Name": "Convolve",
"Input": ["trial_type.word", "trial_type.pseudoword"],
"Model": "spm"
}
],
"Model": {
"X": [
"trial_type.word",
"trial_type.pseudoword",
"framewise_displacement",
"trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z",
"a_comp_cor_00", "a_comp_cor_01", "a_comp_cor_02",
"a_comp_cor_03", "a_comp_cor_04", "a_comp_cor_05"
]
},
"DummyContrasts": {
"Conditions": ["trial_type.word", "trial_type.pseudoword"],
"Type": "t"
},
"Contrasts": [
{
"Name": "word_gt_pseudo",
"ConditionList": [
"trial_type.word",
"trial_type.pseudoword"
],
"Weights": [1, -1],
"Type": "t"
},
{
"Name": "task_vs_baseline",
"ConditionList": [
"trial_type.word",
"trial_type.pseudoword"
],
"Weights": [0.5, 0.5],
"Type": "t"
}
]
},
{
"Level": "subject",
"DummyContrasts": {
"Type": "FEMA"
}
},
{
"Level": "dataset",
"DummyContrasts": {
"Conditions": ["word_gt_pseudo", "task_vs_baseline"],
"Type": "t"
},
"Contrasts":[
{
"Name": "any_words",
"ConditionList": [
"trial_type.word",
"trial_type.pseudoword"
],
"Weights": [
[1, 0],
[0, 1]
],
"Type": "F"
}
]
}
]
}
|
Balloon Analog Risk Task¶
Dataset: https://openneuro.org/datasets/ds000030/versions/00016
The balloon analog risk task (BART) is a risk-taking game where participants
decide whether to inflate a balloon, risking explosion, or cash out.
There are two trial types (BALOON
[sic] and CONTROL
), and three
possible actions (ACCEPT
, CASHOUT
, EXPLODE
).
In this model, we contrast responses to ACCEPT
and EXPLODE
actions
in BALOON
trials only.
This model is similar to the word-pseudoword model above, but also demonstrates
the use of the And
transformation, that takes the logical and of two binary
(0
/1
) columns and assigns a new name to the result.
ds000030/models/model-001_smdl.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | {
"Name": "ds000030_bart",
"Description": "model for balloon analog risk task",
"Input": {
"task": "bart"
},
"Steps": [
{
"Level": "run",
"Transformations": [
{
"Name": "Factor",
"Input": [
"trial_type",
"action"
]
},
{
"Name": "And",
"Input": [
"trial_type.BALOON",
"action.ACCEPT"
],
"Output": [
"accept"
]
},
{
"Name": "And",
"Input": [
"trial_type.BALOON",
"action.EXPLODE"
],
"Output": [
"explode"
]
},
{
"Name": "Convolve",
"Input": ["accept", "explode"],
"Model": "spm"
}
],
"Model": {
"X": [
"accept", "explode",
"framewise_displacement",
"trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z"
]
},
"Contrasts": [
{
"Name": "accept_vs_explode",
"ConditionList": [
"accept",
"explode"
],
"weights": [1, -1],
"type": "T"
}
]
},
{
"Level": "dataset",
"DummyContrasts": {
"Conditions": ["accept_vs_explode"],
"Type": "t"
}
}
]
}
|
DS000114 Model¶
Dataset: doi:10.18112/openneuro.ds000114.v1.0.1
This model was written to demonstrate a model that specifies all levels of analysis.
The finger_foot_lips
task is a block-design motor task with interleaved
blocks of finger-tapping, foot-twitching and lip-pursing.
The Factor
and Convolve
transforms will be familiar from the above
models.
The contrast, however, shows a three-way contrast, testing for greater response
to finger than foot or lip actions.
Note that the negative values sum to -1
and the positive to 1
.
At the session
level, no contrast is performed; rather the finger_vs_other
contrasts are split across sessions, to avoid grouping them at the subject level.
The contrast at the subject level is a simple test - retest
contrast, and
finally the dataset level again takes a simple mean across subjects.
Note
This model can be run by FitLins, but it has a second-level contrast that
Nistats cannot currently handle, so all group level stats will be NaN
.
ds000114/models/model-001_smdl.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | {
"Name": "ds114_model1",
"Description": "sample model for ds114",
"Input": {
"task": "fingerfootlips"
},
"Steps": [
{
"Level": "run",
"Transformations": [
{
"Name": "Factor",
"Input": ["trial_type"]
},
{
"Name": "Convolve",
"Input": [
"trial_type.Finger",
"trial_type.Foot",
"trial_type.Lips"
]
}
],
"Model": {
"X": [
"trial_type.Finger",
"trial_type.Foot",
"trial_type.Lips",
"framewise_displacement",
"trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z",
"a_comp_cor_00", "a_comp_cor_01", "a_comp_cor_02",
"a_comp_cor_03", "a_comp_cor_04", "a_comp_cor_05"
]
},
"Contrasts": [
{
"Name": "finger_vs_others",
"ConditionList": [
"trial_type.Finger",
"trial_type.Foot",
"trial_type.Lips"
],
"Weights": [
1,
-0.5,
-0.5
],
"Type": "t"
}
]
},
{
"Level": "session",
"Transformations": [
{
"Name": "split",
"Input": ["finger_vs_others"],
"By": "session"
}
]
},
{
"Level": "subject",
"Model": {
"X": [
"finger_vs_others.test",
"finger_vs_others.retest"
]
},
"Contrasts": [
{
"Name": "session_diff",
"ConditionList": [
"finger_vs_others.test",
"finger_vs_others.retest"
],
"Weights": [1, -1],
"Type": "t"
}
]
},
{
"Level": "dataset",
"DummyContrasts": {
"Conditions": ["session_diff"],
"Type": "t"
}
}
]
}
|
DS000117 Model¶
Dataset: doi:10.18112/openneuro.ds000117.v1.0.3
This model is translated from model001 in the original OpenFMRI dataset.
This model is another basic contrast, mostly interesting because there are several runs per subject to be averaged over before taking the group average.
FitLins does not currently support fixed effects models, but this will be updated as we decide how to indicate that an analysis level should be a fixed or random effects combination.
It also demonstrates the use of the logical Or
transformation.
ds000117/models/model-001_smdl.json
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | {
"Name": "Basic",
"Description": "",
"Input": {
"task": "facerecognition"
},
"Steps": [
{
"Level": "run",
"Transformations": [
{
"Name": "Factor",
"Input": ["stim_type"]
},
{
"Name": "Or",
"Input": [
"stim_type.FAMOUS",
"stim_type.UNFAMILIAR"
],
"output": [
"stim_type.REAL"
]
},
{
"Name": "Convolve",
"Input": [
"stim_type.REAL",
"stim_type.SCRAMBLED"
]
}
],
"Model": {
"X": [
"stim_type.SCRAMBLED",
"stim_type.REAL",
"trans_x", "trans_y", "trans_z", "rot_x", "rot_y", "rot_z"
]
},
"Contrasts": [
{
"Name": "face_vs_scram",
"ConditionList": [
"stim_type.REAL",
"stim_type.SCRAMBLED"
],
"weights": [1, -1],
"type": "t"
}
]
},
{
"Level": "subject",
"DummyContrasts": {
"Conditions": ["face_vs_scram"],
"Type": "FEMA"
}
},
{
"Level": "dataset",
"DummyContrasts": {
"Conditions": ["face_vs_scram"],
"Type": "t"
}
}
]
}
|