### Extracting microstate features for statistics

Once you have come to some meaningful mean microstate class maps ans sorting order across your data, or if you have decided to just used existing mean microstate class maps, you can extract the temporal features of the microstates for further statistics. In the EEGLAB interface, this is available in "Tools->Microstates->Quantify microstates in dataset" (with different options for the type of microstate class maps to use). The dialogs that open let you select the datasets to be analysed, the mean microstate class maps to be used for the fitting (if applicable) and the fitting parameters. At the end of the computation, you will be prompted for an output file, that can be saved in a series of formats.

The output file contains, for each EEG dataset, the following:

**DataSet:**The name of the dataset**Subject**: The subject ID, if available in the EEG data structure**Group:**The group, if available in the EEG data structure**Condition:**The condition, if available in the EEG data structure**Template:**Which microstate class maps have been used**SortInfo:**How the used microstate class maps have been sorted**ExpVar:**The variance explained by the model**TotalTime:**The total analysis time**Duration_X:**The mean duration of microstates of class X, in sec.**MeanDuration**: The mean microstate duration across all classes, in sec.**Occurrence_X**: The mean frequency of observation of microstates of class X, per sec.**MeanOccurrence:**The mean frequency of observation of microstates, across class X, per sec.**Contribution_X:**The proportion of the total time spent in microstates of class X**MeanGFP_X:**The mean GFP of microstates of class X, in microVolt.**OrgTM_X->Y:**The proportion of all observed microstate transitions that went from X to Y**ExpTM_X->Y:**The proportion of expected microstate transitions from X to Y, given only the observed occurrences**DeltaTM_X->Y:**The difference between the observed and the expected transition probabilities.

The function can also be evoked by the following function:

**com = pop_QuantMSTemplates(ALLEEG, CURRENTSET, UseMeanTmpl, FitParameters, MeanSet, FileName);**

ALLEEG is a structure with all the EEGs that may be analysed. CURRENTSET is a selection index into ALLEEG; if more than one EEG is selected, the analysis, will be limited to those, if not, the user is asked. Make UseMeanTmpl 0 if the template from the data itself is to be used, 1 if a mean template is to be used, or 2 if a published template is to be used. The FitParameters are identical the ones used for the display and saving of microstate dynamics. The Meanset is a selection index for the ALLEEG dataset containing the mean clusters to be used if UseMeanTmpl is true, and the Filename is the name of the file to store the output.