Compute permutation test with with multiples comparison procedure (cluster-mass, TFCE or Troendle).

  np = 5000,
  method = NULL,
  type = "permutation",
  test = "fisher",
  aggr_FUN = NULL,
  threshold = NULL,
  multcomp = "clustermass",
  effect = NULL,



A formula defining the design of the model. The left part should be a 3 dimensional array. Its rows are the observations (or design), its column are the samples (or time-point) and the third dimension are the space (or the nodes of the graph). Each row should correspond to the design in the data argument.


A dataframe containing the design.


An igraph object. It specifies the neighborhoods/adjacency between the signals/nodes.


A scalar indicating the number of permutations. It will be overwrite if P is manually specified.


A character string to specify the re-sampling method. See permuco for details on permutation methods.


A character string to specify the type of re-sampling transformation. Default is "permutation" and "signflip" is also available. Is overridden if P is specified. See help from Pmat in permuco.


A character string to specify the name of the test. Default is "fisher". "t" is available for the fixed effects model.


A function used as mass function. It should aggregate the statistics of a cluster into one scalar. Default is the sum of squares for t statistic and sum for F statistic.


See clusterlm in permuco.


The multiple comparison procedure only "clustermass" (default), "tfce", "troendle"is available.


An integer indicating the effect to test. It refers to the assign attribute of the model.matrix object. The default (effect = NULL) compute all effects.


further arguments


a brainperm object.


The random effects model is only available with a F statistic.

Other arguments could be pass in ... :

P : A matrix containing the permutation of class matrix or Pmat; which is used for the reproducibility of the results. The first column must be the identity. P overwrites np argument.

return_distribution = FALSE : return the permutation distribution of the statistics. Warnings : return one high dimensional matrices (number of test times number of permutation) for each test.
coding_sum = TRUE : a logical defining the coding of the design matrix to contr.sum: set by default to TRUE for ANOVA (when the argument test is "fisher" ) to tests main effects and is set to FALSE when test is "t". If coding_sum is set to FALSE the design matrix is computed with the coding defined in the dataframe and the tests of simple effects are possible with a coding of the dataframe set to contr.treatment.
E = 0.5 : a numeric for extend parameter of the TFCE. H : a numeric for height parameter of the TFCE. When test = "t", the default is H = 2 and when test = "fisher", the default is H = 1. ndh = 500 : an integer defining the number of steps when estimating the integral of the TFCE.