Skip to content

← statistics package

GroupedMean

Group instances (trials) and calculate the mean, and optionally the error, for each group.

Instances refers to items along an Instance axis; typically these equate to "trials" that were segmented using Segmentation based on event markers specified as targets in AssignTargets. The Instance axis has a data array which itself can contain any number of fields, so that each instance/trial can have a set of fields associated with it (i.e., Marker, TargetValue, are most common, the latter is where AssignTargets stores its class values; the statistics nodes create others; you can add your own). In statistics these are typically used to represent factors. By default, if the "group-by fields" are not specified, this node will create a group for each unique combination of values in all fields marked as a category field, so typically this would be one group per class in TargetValue. Therefore, a typical use case for this node is to compute ERPs by assigning target values to event markers using AssignTargets, segmenting the data into instances (trials) using Segmentation, computing spectrum, process, etc., and then calculate the mean and error for each class using this node with its defaults (i.e., no group-by fields specified). Version 1.1.1

Ports/Properties

data

Data to process.

verbose name
Data
default value
None
port type
DataPort
value type
Packet (can be None)
data direction
INOUT

group_cols

Optionally specify the names of instance data table fields that will be used to determine grouping. e.g. ['Marker'] or ['Subject', 'Marker']

verbose name
Group-By Fields
default value
None
port type
ListPort
value type
list (can be None)

mean_type

Type of mean estimate to compute. Note that the Huber mean is not a mass-univariate but a multivariate mean, which may not be what you expect.

verbose name
Estimator
default value
mean
port type
EnumPort
value type
str (can be None)

trim_proportion

Proportion of data instances to trim (per variable) on the lower and upper tails of the data. If only a single number is provided then it is used for both lower and upper. If no non-zero numbers are provided then no trimming is performed (default).

verbose name
Trim Proportion
default value
[0, 0]
port type
ListPort
value type
list (can be None)

winsorize

If trim_proportion has a non-zero value, then setting winsorize to True (default) will cause winsorization to be used instead of standard trimming.

verbose name
Winsorize
default value
True
port type
BoolPort
value type
bool (can be None)

error_type

Add 'grouped_mean' StatisticAxis to the chunk, containing param_types=[stats.P arameterType.ESTIMATE, stats.ParameterType.ERROR]. std: standard deviation; sem: standard error of the mean; var: variance; mad: median absolute difference; CI: upper confidence interval - mean. See ci_range parameter.

verbose name
Error Type
default value
none
port type
EnumPort
value type
str (can be None)

fill_cols

If True, instance columns that are not used for grouping will be filled with reasonable default values. If False, instance columns that are not used for grouping will be masked out in the output instance axis data.

verbose name
Fill Cols
default value
True
port type
BoolPort
value type
bool (can be None)

grouping_type

If levels (default), then means (and optionally errors) are calculated per unique level of each factor and interaction. If unpaired-diffs, then differences of means are calculated for each pair of levels. Use this option to calculate differences in means and difference error analogous to a two independent sample t-test assuming equal variances. When error_type is not none, a common variance is calculated instead of using the group-variances. If global, then only a single mean (and error) is calculated for all instances.

verbose name
Grouping Type
default value
levels
port type
EnumPort
value type
str (can be None)

equal_var

If grouping_type is 'unpaired-diffs', set this to True to assume equal population variance among groups. If False (default), unequal population variance among groups is assumed.

verbose name
Equal Var
default value
False
port type
BoolPort
value type
bool (can be None)

ddof

Passed to numpy.s td. In standard statistical practice, ddof=1 provides an unbiased estimator of the variance of the infinite population. ddof=0 provides a maximum likelihood estimate of the variance for normally distributed variables.

verbose name
Ddof
default value
1
port type
IntPort
value type
int (can be None)

sort_order

If alphabetical (default), instance axis elements are returned in alphabetical order, otherwise they are returned in order of first appearance.

verbose name
Sort Order
default value
alphabetical
port type
EnumPort
value type
str (can be None)

ci_range

Range for confidence interval if CI selected as error_type.

verbose name
Ci Range
default value
0.95
port type
FloatPort
value type
float (can be None)

allow_markers

If true, marker streams with an instance axis will be processed; otherwise they will be ignored.

verbose name
Allow Markers
default value
True
port type
BoolPort
value type
bool (can be None)

use_caching

Enable caching.

verbose name
Use Caching
default value
False
port type
BoolPort
value type
bool (can be None)

set_breakpoint

Set a breakpoint on this node. If this is enabled, your debugger (if one is attached) will trigger a breakpoint.

verbose name
Set Breakpoint (Debug Only)
default value
False
port type
BoolPort
value type
bool (can be None)

metadata

User-definable meta-data associated with the node. Usually reserved for technical purposes.

verbose name
Metadata
default value
{}
port type
DictPort
value type
dict (can be None)