Giter Site home page Giter Site logo

plot_erp's Introduction

plot_erp

plot_erp is a MATLAB-based script to plot event-related potentials (ERPs) from any number of given epoched datasets (in EEGLAB format), for a single channel. For each ERP curve, any number of datasets can be given. It can optionally calculate and plot a difference wave, standard errors of the mean, and permutation-based statistics (using an included local version of permutationTest). Mean curves and statistics can be calculated either within or between datasets.

Sample screenshots:

Two ERPs plus their difference, standard error of the mean for all curves, and statistics highlighting significant differences in grey.

Screenshot

ERPs for eight groups of 19 datasets each with custom colour code, labels, and x scale indicator position.

Screenshot

Sample usage

Say you have epoched EEG data for two participants, and three conditions each: p1c1, p1c2, p1c3, p2c1, etc. Calling

plot_erp({p1c1}, 'Fz');

will then plot the mean ERP of all epochs in p1c1 at channel Fz. Calling

plot_erp({p1c1, p2c1}, 'Fz', 'plotdiff', 1);

will plot the mean ERPs of participants one and two separately for condition one. Because plotdiff is 1, the difference between these two will also be plotted.

plot_erp({{p1c1, p2c1}, {p1c2, p2c2}}, 'Fz', 'plotdiff', 1, 'permute', 10000);

will first take the mean of each given dataset, before calculating the mean within the given conditions and plotting those. Where previously n equalled the number of trials per dataset, here, n = 2 for each ERP. This is indicated in the legend for each trace. A permutation test of 10000 permutations will additionally be performed to find significant differences between the two conditions on a per-sample basis.

Any number of ERPs can be plotted. Just as

plot_erp({p1c1, p1c2, p1c3}, 'Fz');

will plot each condition separately for participant one (n equalling the number of trials per dataset for each ERP), so will

plot_erp({{p1c1, p2c1}, {p1c2, p2c2}, {p1c3, p2c3}}, 'Fz', 'plotstd', 'fill');

plot one grand average ERP for each condition. The plotstd argument additionally adds the standard error of the mean to each ERP (with, now again, n = 2). plotdiff and permute can only be used when two ERPs are requested.

The number of datasets per ERP trace need not be equal. For example, calling

plot_erp({{p1c1, p2c1}, p3c1}, 'Fz');

will compare the mean of participant one and two to that of participant three. Note that by default, whether or not to first average within datasets before averaging them together, or to average across all epochs, is determined by the number of datasets for the first trace. Here, n would be 2 and 1, respectively. This behaviour can be changed by setting avgmode.

The script does not work directly with EEGLAB's study format. If, however, all study datasets are saved in memory, and they are ordered consistently, you can use the indices in ALLEEG to refer to specific conditions. For example, a study of 20 participants with 8 conditions each, all loaded in the same order as separate datasets, will have 160 datasets in ALLEEG. To plot the first three conditions against each other, you can use:

plot_erp({ALLEEG(1:8:160), ALLEEG(2:8:160), ALLEEG(3:8:160)}, 'Cz');

plot_erp's People

Contributors

lrkrol avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.