ptest {ClusterBootstrap} | R Documentation |
Perform permutation tests for differences between two groups at given within-subject levels in a long-formatted dataframe
ptest( data, outcome, within, between, at.within, at.between, pn = 1000, progress.bar = TRUE )
data |
dataframe that contains the data in long format. |
outcome |
outcome variable (i.e., the variable for which the difference should be tested). |
within |
within-subject variable. |
between |
between-subjects variable. |
at.within |
determine for which within-subject levels (e.g., which timepoint) the difference should be tested. |
at.between |
determine the groups in the difference test (should always be of length 2). |
pn |
the number of permutations that should be performed. |
progress.bar |
indicates whether a progress bar will be shown. |
In every permutation cycle, the outcome variable gets permutated and the Welch t test statistic is calculated.
ptest
produces an object of class "clusbootptest"
, containing the following relevant components:
perm.statistics |
A matrix of |
pvalues |
Data frame containing the p values for every |
Mathijs Deen, Mark de Rooij
A useful method for the obtained clusbootptest
class object is plot.clusbootptest
.
## Not run: medication <- medication[medication$time %% 1 == 0,] set.seed(1) permtest.1 <- ptest(data = meds, outcome = pos, within = time, between = treat, at.within = c(0,2,4,6), at.between = c(0,1), pn = 2000) permtest.1$pvalues ## End(Not run)