Title: | Permutation Tests for Regression, (Repeated Measures) ANOVA/ANCOVA and Comparison of Signals |
---|---|
Description: | Functions to compute p-values based on permutation tests. Regression, ANOVA and ANCOVA, omnibus F-tests, marginal unilateral and bilateral t-tests are available. Several methods to handle nuisance variables are implemented (Kherad-Pajouh, S., & Renaud, O. (2010) <doi:10.1016/j.csda.2010.02.015> ; Kherad-Pajouh, S., & Renaud, O. (2014) <doi:10.1007/s00362-014-0617-3> ; Winkler, A. M., Ridgway, G. R., Webster, M. A., Smith, S. M., & Nichols, T. E. (2014) <doi:10.1016/j.neuroimage.2014.01.060>). An extension for the comparison of signals issued from experimental conditions (e.g. EEG/ERP signals) is provided. Several corrections for multiple testing are possible, including the cluster-mass statistic (Maris, E., & Oostenveld, R. (2007) <doi:10.1016/j.jneumeth.2007.03.024>) and the threshold-free cluster enhancement (Smith, S. M., & Nichols, T. E. (2009) <doi:10.1016/j.neuroimage.2008.03.061>). |
Authors: | Jaromil Frossard [aut, cre], Olivier Renaud [aut] |
Maintainer: | Jaromil Frossard <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1.3 |
Built: | 2025-02-21 04:45:17 UTC |
Source: | https://github.com/jaromilfrossard/permuco |
Provides p-values for omnibus tests based on permutations for factorial and repeated measures ANOVA. This function produces the F statistics, parametric p-values (based, on Gaussian and sphericity assumptions) and p-values based on the permutation methods that handle nuisance variables.
aovperm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", ... )
aovperm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", ... )
formula |
A formula object. The formula for repeated measures ANOVA should be written using the same notation as aov by adding
|
data |
A data frame or matrix. |
np |
The number of permutations. Default value is |
method |
A character string indicating the method used to handle nuisance variables. Default is |
type |
A character string to specify the type of transformations: "permutation" and "signflip" are available. Is overridden if P is given. See help from Pmat. |
... |
Futher arguments, see details. |
The following methods are available for the fixed effects model defined as . If we want to test
and take into account the effects of the nuisance variables
, we transform the data :
method argument |
|
|
|
"draper_stoneman" |
|
|
|
"freedman_lane" |
|
|
|
"manly" |
|
|
|
"terBraak" |
|
|
|
"kennedy" |
|
|
|
"huh_jhun" |
|
|
|
"dekker" |
|
|
|
The following methods are available for the random effects model . If we want to test
and take into account the effect of the nuisance variable
we can transform the data by permutation:
method argument |
|
|
|
|
|
"Rd_kheradPajouh_renaud" |
|
|
|
|
|
"Rde_kheradPajouh_renaud" |
|
|
|
Other arguments could be pass in ...
:P
: a matrix, of class matrix
or Pmat
, containing the permutations (for the reproductibility of the results). The first column must be the identity permutation (not checked). P
overwrites np
argument. rnd_rotation
: a random matrix of size to compute the rotation used for the
"huh_jhun"
method.
coding_sum
: a logical set to TRUE
defining the coding of the design matrix to contr.sum
to test the main effects. If it is set to FALSE
the design matrix is computed with the coding defined in the dataframe. The tests of simple effets are possible with a coding of the factors of the dataframe set to contr.treatment
.
A lmperm
object containing most of the objects given in an lm object, an ANOVA table with parametric and permutation p-values, the test statistics and the permutation distributions.
Other main function:
clusterlm()
,
lmperm()
## data data("emergencycost") ## centrering the covariate to the mean emergencycost$LOSc <- scale(emergencycost$LOS, scale = FALSE) ## ANCOVA ## Warning : np argument must be greater (recommendation: np>=5000) mod_cost_0 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000) mod_cost_0 ## same analysis but with signflip ## Warning : np argument must be greater (recommendation: np>=5000) mod_cost_0s <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, type="signflip", np = 2000) mod_cost_0s ## Testing at 14 days emergencycost$LOS14 <- emergencycost$LOS - 14 mod_cost_14 <- aovperm(cost ~ LOS14*sex*insurance, data = emergencycost, np = 2000) mod_cost_14 ## Effect of sex within the public insured contrasts(emergencycost$insurance) <- contr.treatment contrasts(emergencycost$sex) <- contr.sum emergencycost$insurance <- relevel(emergencycost$insurance, ref = "public") mod_cost_se <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000, coding_sum = FALSE) mod_cost_se ## Repeated measures ANCOVA ## data data(jpah2016) ## centrering the covariate jpah2016$bmic <- scale(jpah2016$bmi, scale = FALSE) ## Warning : np argument must be greater (recommendation: np>=5000) mod_jpah2016 <- aovperm(iapa ~ bmic*condition*time+ Error(id/(time)), data = jpah2016, method = "Rd_kheradPajouh_renaud") mod_jpah2016
## data data("emergencycost") ## centrering the covariate to the mean emergencycost$LOSc <- scale(emergencycost$LOS, scale = FALSE) ## ANCOVA ## Warning : np argument must be greater (recommendation: np>=5000) mod_cost_0 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000) mod_cost_0 ## same analysis but with signflip ## Warning : np argument must be greater (recommendation: np>=5000) mod_cost_0s <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, type="signflip", np = 2000) mod_cost_0s ## Testing at 14 days emergencycost$LOS14 <- emergencycost$LOS - 14 mod_cost_14 <- aovperm(cost ~ LOS14*sex*insurance, data = emergencycost, np = 2000) mod_cost_14 ## Effect of sex within the public insured contrasts(emergencycost$insurance) <- contr.treatment contrasts(emergencycost$sex) <- contr.sum emergencycost$insurance <- relevel(emergencycost$insurance, ref = "public") mod_cost_se <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000, coding_sum = FALSE) mod_cost_se ## Repeated measures ANCOVA ## data data(jpah2016) ## centrering the covariate jpah2016$bmic <- scale(jpah2016$bmi, scale = FALSE) ## Warning : np argument must be greater (recommendation: np>=5000) mod_jpah2016 <- aovperm(iapa ~ bmic*condition*time+ Error(id/(time)), data = jpah2016, method = "Rd_kheradPajouh_renaud") mod_jpah2016
Pmat
object.Convert a matrix into a Pmat
object.
as.Pmat(x)
as.Pmat(x)
x |
a matrix. |
Other pmat:
Pmat_product()
,
Pmat()
Design of an experiment measuring the EEG brain activity of 15 participants who have been shown images of neutral and angry faces. Those faces were shown at a different visibility 16ms and 166ms and were displayed either to the left or to the right of a screen. The laterality, sex, age, and 2 measures of anxiety for each subjects are also available. The amplitude of the EEG recording are located in the dataset attentionshifting_signal.
id : identifier of the subject.
visibility : time of exposure to the image (16ms: subliminal or 166ms:supraliminal).
emotion : type of emotion of the image (angry or neutral).
direction : position of image one the screen (left or right).
laterality_id : measure of laterality of the subject.
age : age of the subject.
sex : sex of the subject.
STAIS_state : measure of the state of anxiety of the subject.
STAIS_trait : measure of the personality trait of anxiety of the subject.
data(attentionshifting_design)
data(attentionshifting_design)
A data frame with 120 rows and 10 variables.
Other dataset:
attentionshifting_signal
,
emergencycost
,
jpah2016
The ERP of the electrod O1 of an experiment in attention shifting. This dataset contains the amplitude of the signals sampled at 1024 Hz. The design of the experiment is given in the dataset attentionshifting_design.
data(attentionshifting_signal)
data(attentionshifting_signal)
A data frame with 120 rows and 819 variables.
ERP (in muV) of the electrod O1 measured from -200 to 600 timeframes before and after the onset of the stimulus.
Other dataset:
attentionshifting_design
,
emergencycost
,
jpah2016
Compute the cluster-mass test for longitudinal linear model.
clusterlm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", test = "fisher", threshold = NULL, aggr_FUN = NULL, multcomp = "clustermass", ... )
clusterlm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", test = "fisher", threshold = NULL, aggr_FUN = NULL, multcomp = "clustermass", ... )
formula |
A formula object where the left part is a matrix defined in the global environment. |
data |
A data frame for the independent variables. |
np |
The number of permutations. Default value is |
method |
A character string indicating the method used to handle nuisance variables. Default is |
type |
A character string to specify the type of transformations: "permutation" and "signflip" are available. Is overridden if P is given. See help from Pmat. |
test |
A character string to specify the name of the test. Default is |
threshold |
A numerical value that specify the threshold for the |
aggr_FUN |
A function used as mass function. It should aggregate the statistics of a cluster into one scalar. Default is the sum of squares fot t statistic and sum for F statistic. |
multcomp |
A vector of character defining the methods of multiple comparisons to compute. Default is |
... |
Futher arguments, see details. |
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.rnd_rotation
: A matrix of random value to compute a rotation of size that will be used for the
"huh_jhun"
method. p_scale = FALSE
: if set to TRUE
, the several multiple comparisons procedures are compute on the 1 - p
scale, where p
is the p-value. The threshold have to be set between 0 and 1 (eg: threshold = 0.95
). The function aggr_FUN
should be big when there is evidence against the null (eg: aggr_FUN = function(p)sum(abs(log(1-p)))
. Moreover under the probability scale the cluster mass statistics is sensitive to the number permutations.H
, E
, ndh
: the parameters used for the "tfce"
method. Default values are set to H = 2
for the height parameter, to E = 0.5
for the extend parameter and to ndh = 500
for the number terms to approximate the integral.alpha = 0.05
: the type I error rate. Used for the troendle
multiple comparisons procedure.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
: 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 effets are possible with a coding of the dataframe set to contr.treatment
.
A clusterlm
object. Use the plot.clusterlm or summary.clusterlm method to see results of the tests.
Maris, E., & Oostenveld, R. (2007). Nonparametric statistical testing of EEG-and MEG-data. Journal of neuroscience methods, 164(1), 177-190.
Smith, S. M., & Nichols, T. E. (2009). Threshold-free cluster enhancement: addressing problems of smoothing, threshold dependence and localisation in cluster inference. Neuroimage, 44(1), 83-98.
plot.clusterlm
summary.clusterlm
Other main function:
aovperm()
,
lmperm()
## Cluster-mass for repeated measures ANOVA ## Warning : np argument must be greater (recommendation: np >= 5000) electrod_O1 <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, np = 50) ## Results plot(electrod_O1) ## Results with labels on the x axis that represent seconds from time-locked event: plot(electrod_O1, nbbaselinepts = 200, nbptsperunit = 1024) ## Tables of clusters electrod_O1 ## Not run: ## Change the function of the aggregation ## Sum of squares of F statistics electrod_O1_sum <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, aggr_FUN = function(x)sum(x^2)) ## Length of the cluster electrod_O1_length <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, aggr_FUN = function(x)length(x)) ## All multiple comparisons procedures for repeated measures ANOVA ## Permutation method "Rde_kheradPajouh_renaud" full_electrod_O1 <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, method = "Rde_kheradPajouh_renaud", multcomp = c("troendle", "tfce", "clustermass", "bonferroni", "holm", "benjamini_hochberg")) ## End(Not run)
## Cluster-mass for repeated measures ANOVA ## Warning : np argument must be greater (recommendation: np >= 5000) electrod_O1 <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, np = 50) ## Results plot(electrod_O1) ## Results with labels on the x axis that represent seconds from time-locked event: plot(electrod_O1, nbbaselinepts = 200, nbptsperunit = 1024) ## Tables of clusters electrod_O1 ## Not run: ## Change the function of the aggregation ## Sum of squares of F statistics electrod_O1_sum <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, aggr_FUN = function(x)sum(x^2)) ## Length of the cluster electrod_O1_length <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, aggr_FUN = function(x)length(x)) ## All multiple comparisons procedures for repeated measures ANOVA ## Permutation method "Rde_kheradPajouh_renaud" full_electrod_O1 <- clusterlm(attentionshifting_signal ~ visibility*emotion*direction + Error(id/(visibility*emotion*direction)), data = attentionshifting_design, method = "Rde_kheradPajouh_renaud", multcomp = c("troendle", "tfce", "clustermass", "bonferroni", "holm", "benjamini_hochberg")) ## End(Not run)
Compute the clusterdepth test correction given a matrix a permuted statistical signals.
compute_clusterdepth(distribution, threshold, alternative = "two.sided")
compute_clusterdepth(distribution, threshold, alternative = "two.sided")
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
threshold |
A scalar that represents the threshold to create the clusters. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth_head()
,
compute_clustermass()
,
compute_maxT()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_tfce()
,
compute_troendle()
Compute the cluster-depth test correction (from the head) given a matrix a permuted statistical signals.
compute_clusterdepth_head(distribution, threshold, alternative = "two.sided")
compute_clusterdepth_head(distribution, threshold, alternative = "two.sided")
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
threshold |
A scalar that represents the threshold to create the clusters. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth()
,
compute_clustermass()
,
compute_maxT()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_tfce()
,
compute_troendle()
Compute the clustermass test correction given a matrix a permuted statistical signals.
compute_clustermass(distribution, threshold, aggr_FUN, alternative = "greater")
compute_clustermass(distribution, threshold, aggr_FUN, alternative = "greater")
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
threshold |
A scalar that respresents the threshold to create the clusters. |
aggr_FUN |
A function to compute the clustermasses. See details for examples. |
alternative |
A character string indicating the alternative hypothesis. Default is |
The aggr_FUN
argument may take predefined function as the sum: aggr_FUN = sum
and also user-defined function as the sum of squares: aggr_FUN = function(x){sum(x^2)}
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_maxT()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_tfce()
,
compute_troendle()
Compute the max-T correction given a matrix a permuted statistics.
compute_maxT(distribution, alternative)
compute_maxT(distribution, alternative)
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_clustermass()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_tfce()
,
compute_troendle()
Compute the min-P correction given a matrix a permuted statistics.
compute_minP(distribution, alternative)
compute_minP(distribution, alternative)
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_clustermass()
,
compute_maxT()
,
compute_stepdownmaxT()
,
compute_tfce()
,
compute_troendle()
Compute the Step-down version of the max-T given a matrix a permuted statistics.
compute_stepdownmaxT(distribution, alternative)
compute_stepdownmaxT(distribution, alternative)
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_clustermass()
,
compute_maxT()
,
compute_minP()
,
compute_tfce()
,
compute_troendle()
Compute the TFCE correction given a matrix a permuted statistical signals.
compute_tfce(distribution, alternative = "greater", E = 0.5, H = 1, ndh)
compute_tfce(distribution, alternative = "greater", E = 0.5, H = 1, ndh)
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
alternative |
A character string indicating the alternative hypothesis. Default is |
E |
A scalar that represent the extend parameter of the TFCE transformation. Default is |
H |
A scalar that represent the height parameter of the TFCE transformation. Default is |
ndh |
The number of terms in the approximation of the integral. |
The approximation of the TFCE integral starts from the minimal statistic (among the permuted statistic), not 0. Indeed, the value of the integral (from 0, to this minimal value) is the same for all time points, all permutations and does not need to be computed to get p-values.
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_clustermass()
,
compute_maxT()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_troendle()
Compute the Troendle's correction given a matrix a permuted statistics.
compute_troendle(distribution, alternative)
compute_troendle(distribution, alternative)
distribution |
A matrix of permuted statistical signal. The first row indicating the observed statistics. |
alternative |
A character string indicating the alternative hypothesis. Default is |
Other multcomp:
compute_clusterdepth_head()
,
compute_clusterdepth()
,
compute_clustermass()
,
compute_maxT()
,
compute_minP()
,
compute_stepdownmaxT()
,
compute_tfce()
Observational data from 176 emergency patients with variables :
data(emergencycost)
data(emergencycost)
A data frame with 176 rows and 5 variables.
sex
.
age
.
insurance
: the type of insurance, private or semi private (semi_private
) or public (public
).
LOS
: the length of the stay in days.
cost
: the cost in CHF.
Heritier, S., Cantoni, E., Copt, S., & Victoria-Feser, M. P. (2009). Robust methods in Biostatistics (Vol. 825). John Wiley & Sons.
Other dataset:
attentionshifting_design
,
attentionshifting_signal
,
jpah2016
A subset of a control experiment measuring the impulsive approach tendencies toward physical activity or sedentary behaviors.
data(jpah2016)
data(jpah2016)
A data frame with 38 rows and 8 variables.
id identifier of the subject.
bmi body mass index.
age.
sex.
condition the experimental condition where the task was to approach physical activity and avoid sedentary behavior (ApSB_AvPA), approach sedentarity behavior and avoid physical activity (ApPA_AvSB), and a control condition (control).
time pre, post.
iapa measure of impulsive approach tendencies toward physical activity (dependant variable).
iasb measure of impulsive approach tendencies toward sedentary behavior (dependant variable).
Cheval, B., Sarrazin, P., Pelletier, L., & Friese, M. (2016). Effect of retraining approach-avoidance tendencies on an exercise task: A randomized controlled trial. Journal of Physical Activity and Health, 13(12), 1396-1403.
Other dataset:
attentionshifting_design
,
attentionshifting_signal
,
emergencycost
Compute permutation marginal tests for linear models. This function produces t statistics with univariate and bivariate p-values. It gives the choice between multiple methods to handle nuisance variables.
lmperm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", ... )
lmperm( formula, data = NULL, np = 5000, method = NULL, type = "permutation", ... )
formula |
A formula object. |
data |
A data frame or matrix. |
np |
The number of permutations. Default value is |
method |
A character string indicating the method use to handle nuisance variables. Default is |
type |
A character string to specify the type of transformations: "permutation" and "signflip" are available. Is overridden if P is given. See help from Pmat. |
... |
Futher arguments, see details. |
The following methods are available for the fixed effects model defined as . If we want to test
and take into account the effects of the nuisance variables
, we transform the data :
method argument |
|
|
|
"draper_stoneman" |
|
|
|
"freedman_lane" |
|
|
|
"manly" |
|
|
|
"terBraak" |
|
|
|
"kennedy" |
|
|
|
"huh_jhun" |
|
|
|
"dekker" |
|
|
|
Other arguments could be pass in ...
:P
: a matrix containing the permutations of class matrix
or Pmat
for the reproductibility of the results. The first column must be the identity. P
overwrites np
argument. rnd_rotation
: a random matrix of size to compute the rotation used for the
"huh_jhun"
method.
A lmperm
object. See aovperm.
Kherad-Pajouh, S., & Renaud, O. (2010). An exact permutation method for testing any effect in balanced and unbalanced fixed effect ANOVA. Computational Statistics & Data Analysis, 54(7), 1881-1893.
Kherad-Pajouh, S., & Renaud, O. (2015). A general permutation approach for analyzing repeated measures ANOVA and mixed-model designs. Statistical Papers, 56(4), 947-967.
Winkler, A. M., Ridgway, G. R., Webster, M. A., Smith, S. M., & Nichols, T. E. (2014). Permutation inference for the general linear model. Neuroimage, 92, 381-397.
Other main function:
aovperm()
,
clusterlm()
## data data("emergencycost") ## Testing at 14 days emergencycost$LOS14 <- emergencycost$LOS - 14 ## Univariate t test contrasts(emergencycost$insurance) <- contr.sum contrasts(emergencycost$sex) <- contr.sum ## Warning : np argument must be greater (recommendation: np>=5000) modlm_cost_14 <- lmperm(cost ~ LOS14*sex*insurance, data = emergencycost, np = 2000) modlm_cost_14
## data data("emergencycost") ## Testing at 14 days emergencycost$LOS14 <- emergencycost$LOS - 14 ## Univariate t test contrasts(emergencycost$insurance) <- contr.sum contrasts(emergencycost$sex) <- contr.sum ## Warning : np argument must be greater (recommendation: np>=5000) modlm_cost_14 <- lmperm(cost ~ LOS14*sex*insurance, data = emergencycost, np = 2000) modlm_cost_14
Plot method for class clusterlm
.
## S3 method for class 'clusterlm' plot( x, effect = "all", type = "statistic", multcomp = x$multcomp[1], alternative = "two.sided", enhanced_stat = FALSE, nbbaselinepts = 0, nbptsperunit = 1, distinctDVs = NULL, ... )
## S3 method for class 'clusterlm' plot( x, effect = "all", type = "statistic", multcomp = x$multcomp[1], alternative = "two.sided", enhanced_stat = FALSE, nbbaselinepts = 0, nbptsperunit = 1, distinctDVs = NULL, ... )
x |
A |
effect |
A vector of character naming the effects to display. Default is |
type |
A character string that specified the values to highlight. |
multcomp |
A character string specifying the method use to correct the p-value. It should match the one computed in the object. Default is the (first) method in the call to clusterlm. See clusterlm. |
alternative |
A character string specifying the alternative hypothesis for the t-test. The available options are |
enhanced_stat |
A logical. Default is |
nbbaselinepts |
An integer. Default is 0. If the origin of the x axis should be shifted to show the start of the time lock, provide the number of baseline time points. |
nbptsperunit |
An integer. Default is 1. Modify this value to change the scale of the label from the number of points to the desired unit. If points are e.g. sampled at 1024Hz, set to 1024 to scale into seconds and to 1.024 to scale into milliseconds. |
distinctDVs |
Boolean. Should the DVs be plotted distictively, i.e. should the points be unlinked and should the name of the DVs be printed on the x axis ? Default is FALSE if the number of DV is large thant 15 or if the method is "clustermass" or "tfce". |
... |
further argument pass to plot. |
Other plot:
plot.lmperm()
"lmperm"
.Show the density of statistics and the test statistic.
## S3 method for class 'lmperm' plot(x, FUN = density, ...)
## S3 method for class 'lmperm' plot(x, FUN = density, ...)
x |
A |
FUN |
A function to compute the density. Default is density. |
... |
futher arguments pass to plot. |
Other argument can be pass to the function : effect
: a vector of character string indicating the name of the effect to plot.
Other plot:
plot.clusterlm()
Compute a permutation matrix used as argument in aovperm, lmperm, clusterlm functions. The first column represents the identity permutation. Generally not suited for the "huh_jhun" method, as the dimension of this matrix does not correspond to the number of observations and may vary for different factors.
Pmat(np = 5000, n, type = "permutation", counting = "random")
Pmat(np = 5000, n, type = "permutation", counting = "random")
np |
A numeric value for the number of permutations. Default is 5000. |
n |
A numeric value for the number of observations. |
type |
A character string to specify the type of transformations: "permutation" and "signflip" are available. See details. |
counting |
A character string to specify the selection of the transformations. "all" and "random" are available. See details. |
couting
can set to :"random"
: np
random with replacement permutations/signflips among the n!
/2^n
permutations/signflips."all"
: all n!
/2^n
possible permutations/signflips.
A matrix n x np containing the permutations/signflips. First permutation is the identity.
Other pmat:
Pmat_product()
,
as.Pmat()
## data data("emergencycost") ## Create a set of 2000 permutations set.seed(42) pmat = Pmat(np = 2000, n = nrow(emergencycost)) sfmat = Pmat(np = 2000, n = nrow(emergencycost), type = "signflip") ## centrering the covariate to the mean emergencycost$LOSc <- scale(emergencycost$LOS, scale = FALSE) ## ANCOVA mod_cost_0 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000) mod_cost_1 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) mod_cost_2 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) mod_cost_3 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = sfmat) mod_cost_4 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost,type="signflip") ## Same p-values for both models 1 and 2 but different of model 0 mod_cost_0 mod_cost_1 mod_cost_2 mod_cost_3 mod_cost_4
## data data("emergencycost") ## Create a set of 2000 permutations set.seed(42) pmat = Pmat(np = 2000, n = nrow(emergencycost)) sfmat = Pmat(np = 2000, n = nrow(emergencycost), type = "signflip") ## centrering the covariate to the mean emergencycost$LOSc <- scale(emergencycost$LOS, scale = FALSE) ## ANCOVA mod_cost_0 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, np = 2000) mod_cost_1 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) mod_cost_2 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = pmat) mod_cost_3 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost, P = sfmat) mod_cost_4 <- aovperm(cost ~ LOSc*sex*insurance, data = emergencycost,type="signflip") ## Same p-values for both models 1 and 2 but different of model 0 mod_cost_0 mod_cost_1 mod_cost_2 mod_cost_3 mod_cost_4
Multiplies a vector or matrix with a Pmat object
Pmat_product(x, P, type = NULL)
Pmat_product(x, P, type = NULL)
x |
A a vector or matrix |
P |
A Pmat object |
type |
A character string indicating the type of transformation. This argument need to be specified if P is not of class Pmat. |
A matrix n x np containing the permutated/signflipped vectors.
clusterlm
object.Display the corrected p-values for each effects. Results of the "clustermass"
procedure.
## S3 method for class 'clusterlm' print(x, multcomp = NULL, alternative = "two.sided", ...)
## S3 method for class 'clusterlm' print(x, multcomp = NULL, alternative = "two.sided", ...)
x |
A |
multcomp |
A character string indicating the multiple comparison procedure to print. Default is NULL a print the first multiple comparisons procedure of the |
alternative |
A character string indicating the alternative hypothesis. Choose between |
... |
Further arguments pass to |
Other summary:
summary.clusterlm()
clusterlm
object.Display the corrected p-values for each effects.
## S3 method for class 'clusterlm' summary( object, alternative = "two.sided", multcomp = NULL, table_type = NULL, ... )
## S3 method for class 'clusterlm' summary( object, alternative = "two.sided", multcomp = NULL, table_type = NULL, ... )
object |
A |
alternative |
A character string indicating the alternative hypothesis. Choose between |
multcomp |
A character string indicating the multiple comparison procedure to display. |
table_type |
A character string indicating the type of table to display. Choose between |
... |
Further arguments see details. |
It creates the full table when the number of tests is <=15 and creates a table of pseudo-clusters overwise. Note that for the "troendle"
method is not based on clustering of the data and the table of pseudo-clusters should only be used to facilitate the reading of the results.
A table for each effect indicating the statistics and p-values of the clusters.
Other summary:
print.clusterlm()