bsmschema.models.Contrast#
- object Contrast#
Contrasts are weighted sums of parameter estimates (betas) generated by a model fit.
Contrastdefines the structure of the elements of theNode.Contrastslist.Along with
DummyContrasts, Contrasts define the outputs of aNode.While
"t"and"pass"contrasts are passed as inputs to the next node,"F"contrasts are terminal and are not passed as inputs to followingNodes.Examples
Subtract two conditions:
{ "Name": "a_vs_b", "ConditionList": ["A", "B"], "Weights": [1, -1], "Test": "t" }
Contrast one condition to the average of two others:
{ "Name": "a_vs_other", "ConditionList": ["A", "B", "C"], "Weights": [1, -0.5, -0.5], "Test": "t" }
To pass an individual parameter estimate without changing its name to following nodes:
{"Name": "A", "ConditionList": ["A"], "Weights": [1], "Test": "t"}
- Config:
extras: str = forbid
- field Name: str [Required]#
The name of the contrast. Must be unique in
Node.Contrastsand must not appear inDummyContrasts.Contrastsfor the same Node.This name will be attached to output statistical maps via the
"contrast"entity.
- field ConditionList: list[Literal[1] | str] [Required]#
A list of variables used to compute the contrast. Must be a subset of the variables listed in
Model.X.The special intercept value
1is permitted.
- field Weights: list[int | float | str] | list[list[int | float | str]] [Required]#
A 1D or 2D array of weights. The array must have exactly the same number of total elements as in
ConditionList. For t-tests, a 1D array must be passed. For F-tests, either a 1D or a 2D array may be passed. Variables are mapped 1-to-1 onto weights in the order they appear in ConditionList. Fractional values MAY be passed as strings (e.g., “1/3”).