TrajTracker analysis toolbox: Regressions

To read basic explanations about TrajTracker's regression analyses, visit our website

For a list of all regression functions, run:

  help tt.reg

Contents

Overview

TrajTracker's approach is to run one regression per subject, and analyze the regression coefficients (b or beta) to obtain a group-level effect. When the analyzed data (the dependent variable, the predictors, or both) is a "dynamic" measure (i.e., its value changes throughout the trajectory), this analysis is performed in different points along the trajectory - usually, for different absolute time points, starting from the finger movement onset time and proceeding in fixed intervals.

TrajTracker regressions are typically handled by two functions:

Defining the predictors and the dependent variable

TrajTracker supports a set of predefined measures, each of which can be used as predictor or as a dependent variable. You create a regression model simply by defining the measure names, e.g.:

  tt.reg.regress(expData, 'reg', 'avgvel', {'target', 'prevtarget'})

This function uses a regression model where the dependent variable is the average velocity in the trial ('avgvel') and there are 2 predictors: the target number of the present trial and of the previous trial.

The TrajTracker-supported trial-level measures are defined in tt.reg.getTrialMeasures().

Here's another example:

  tt.reg.regress(expData, 'reg', 'Traj.XSpeed', {'target', 'prevtarget'}, 'TPDep')

In this example, the dependent variable is the momentary x speed ("Traj.XSpeed"). This value changes per time point - this is indicated by the 'TPDep' parameter (a similar parameter 'TPPred' indicates that the predictor value changes per time point). The TrajTracker-supported dynamic (within-trajectory) measures are defined in tt.reg.getTrialDynamicMeasures().

If you want to define a measure, not provided in the default TrajTracker scripts, you can do this in several ways:

Defining the trials included in the regression analysis

TrajTracker runs one regression per subject, and potentially also per time point. Within each of these regressions, the default mode is that each trial contributes a single data point. You can override this default behavior in two ways:

   tt.reg.regress(....., 'TrialFilter', @(trial)trial.Target>20)

Grouping time points

This topic is relevant only for dynamic regressions, i.e., regressions that run per time point.

By default, one regression will be run per time point, starting at t=0 and proceeding in fixed time intervals. If some trials end earlier than others, these trials will be artifically extended using their endpoint values.

The regress() function provides several parameters for tweaking this behavior: 'dt' defines the delay between regressions, and 'Row1OffsetFunc' or 'Row1OffsetAttr' allows starting the regressions at a time point other than t=0.

Alternatively, you can use the 'rows' parameter to explicitly provide numbers of rows in the trajectory matrix.

Last, you can use each of the above mechanisms to define "virtual time points", and use 'TpToRowFunc' to convert these time points, per trial, into row numbers in the trajectory matrix.

The results format

The regression results are organized in a multi-level data structure:

oneRR.getPredResult(predictor_name)

Group-level analyses & plotting the regression results

After regressions were run, we can examine, per time point, whether the effect of a predictor is significantly larger than 0 or than another predictor. This is done via the tt.reg.compareParams() function.

The output of tt.reg.compareParams() is also used for plotting the regression results with tt.reg.plotParamComparison().

To plot the results of a single subject, transform the regression results into the format required by plotParamComparison() - this is done using the tt.reg.reformatOneRRForPlots() function.