Skip to content

2.3.17 getGroupedTrialStats()

Shun Li edited this page Jan 2, 2024 · 3 revisions

Overview

Get trial statistics for a given range of inputs. Made compatible with plotGroupedTrialStats().

Inputs and options

Required inputs

  • animals: struct, can be either animals struct (not tested on summary struct but might work)
  • statsTypes: Name of the variable to extract
    • Can either be a list or a char/string. If it's a list, then it has to have the same number of elements as the task (taskRange).

Options

  • concatSessions: double, default is true. Concatenate all sessions. Will separate sessions if equals to false.
  • eventRange: string, default is 'All', else you can enter something like {'Stim','Pair'}
  • animalRange: string, default is 'All', else you can enter something like {'SL133','SL135'}
  • taskRange: string, default is 'All', else you can enter something like {'Reward1','Reward2'}
  • sessionRange: string, default is 'All', else you can enter something like {'R1','R2'} to select session with contains 'R1/R2'
  • signalRange: string, default is 'All', else you can enter something like {'NAc','LHb'}
  • totalTrialRange: string, default is 'All', else you can enter something like [1,60]. See Details section in combineTraces() for relationship between totalTrialRange and trialRange.
  • trialRange: string, default is 'All', else you can enter something like [1,20]
  • inTrialTable: logical, no default value. When running the function, it will automatically determine whether the statistics of interest is stored in trial table or not.

Outputs

  • combinedStats: struct, have two fields as following:
    • stats: stores the statistics of interest.
    • options: options used. The most important one is inTrialTable, which will be used in plotGroupedTrialStats().

Examples

stats = getGroupedTrialStats(animals,'stageAvg',...
                            eventRange=eventRange,...
                            animalRange=animalRange,...
                            taskRange=taskRange,...
                            totalTrialRange=[1,150],...
                            signalRange=signalRange,...
                            concatSessions=false);

This will generate combinedStats structure with following contents:

combinedStats.stats

Each cell here indicates a specific task (e.g. 'Reward pairing', 'Punish pairing'). image

combinedStats.stats{1}

Each row here indicates an animal, each column indicates a event type for that animal (e.g. 'Stim','Pair'). image

combinedStats.stats{1}{1,1}

Each row indicates a trial, each column indicates a specific stage if applicable. For variables in trial table, this will only have one column. image

combinedStats.options

image

Clone this wiki locally