permuco4brain provides functions to compute permutation test in brain imagery data. It is designed for M-EEG/ERP data. permuco4brain is an add-on to permuco to computing cluster-mass tests, the “threshold-free clusters-enhancement” and the Troendle’s procedure for tests distribution in space and time (e.g.: full-scalp EEG data).


permuco4brain currently works jointly with permuco 1.1.1 (github). Download it using:

devtools::install_github("jaromilfrossard/permuco", build_vignettes = TRUE)

permuco4brain is still under development and you can expect changes. Make sure to install permuco4brain with its full documentation:

devtools::install_github("jaromilfrossard/permuco4brain", build_vignettes = TRUE)


The main function of permuco4brain is brainperm() and it needs:

  1. formula: a formula object defining the design (right side) and a 3D array containing the signals (left side). The signal is a 3D array visible in the global environment. Its dimension is the design X samples X channels. Each “rows” of the 3D array should be related to the corresponding row of the design (data argument).
  2. data: a dataframe containing the variables of the design.
  3. graph: an igraph object defining spatial adjacency of the channels (third dimension of the signal). The names of the vertices should correspond to the names of the 3rd dimension of signal.

By default, the brainperm() function produces the cluster-mass test, but you can choose the TFCE with the argument multcomp = "tfce" or the Troendle’s procedure multcomp = "troendle".

permuco4brain uses the future package to handle multi-cores computing.

You can inspect result using the summary() method and visualize them using image().


Visit or check the vignette:

  1. The permuco4brain-with-eeguana vignette presents how to use permuco4brain in combination with eeguana :
vignette("permuco4brain-with-eeguana", package = "permuco4brain")

You will find information how to extract the 3D array, the design data-frame and the graph from an eeg_lst object of the eeguana package. Check the eeguana package for pre-processing EEG data within R (

  1. The download-example-cheval vignette presents how to use permuco4brain with signals stored in edf files:
vignette("download-example-cheval", package = "permuco4brain")

In this tutorial, you learn how to download EEG data from zenodo and analyze them using permuco4brain.

  1. The tfce vignette presents how to use permuco4brain and future to run the TFCE:
vignette("tfce", package = "permuco4brain")
  1. The figure-ggplot2 vignette presents how to use ggplot2 to produce graphical representation of the results for publication:
vignette("figure-ggplot2", package = "permuco4brain")

In this tutorial, you find 3 different types of plot that present the results of a cluster-mass test or TFCE. All of them use the ggplot2 package and may easily be customized for publication.