ptest {ClusterBootstrap} | R Documentation |
Permutation test for group differences at within-subject levels
Description
Perform permutation tests for differences between two groups at given within-subject levels in a long-formatted dataframe
Usage
ptest(
data,
outcome,
within,
between,
at.within,
at.between,
pn = 1000,
progress.bar = TRUE
)
Arguments
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. |
Details
In every permutation cycle, the outcome variable gets permutated and the Welch t test statistic is calculated.
Value
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 |
Author(s)
Mathijs Deen, Mark de Rooij
See Also
A useful method for the obtained clusbootptest
class object is plot.clusbootptest
.
Examples
## 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)