clusterpermute {jlmerclusterperm} | R Documentation |
Conduct a cluster-based permutation test
Description
Conduct a cluster-based permutation test
Usage
clusterpermute(
jlmer_spec,
family = c("gaussian", "binomial"),
statistic = c("t", "chisq"),
threshold,
nsim = 100L,
predictors = NULL,
binned = FALSE,
top_n = Inf,
add1 = TRUE,
...,
progress = TRUE
)
Arguments
jlmer_spec |
Data prepped for jlmer from |
family |
A GLM family. Currently supports "gaussian" and "binomial". |
statistic |
Test statistic for calculating cluster mass.
Can be one of |
threshold |
The threshold value that the statistic must pass to contribute to cluster mass. Interpretation differs on the choice of statistic (more below):
|
nsim |
Number of simulations description |
predictors |
(Optional) a subset of predictors to test. Defaults to |
binned |
Whether the data has been aggregated/collapsed into time bins. Defaults to |
top_n |
How many clusters to return, in the order of the size of the cluster-mass statistic.
Defaults to |
add1 |
Whether to add 1 to the numerator and denominator when calculating the p-value.
Use |
... |
Optional arguments passed to Julia for model fitting.
Defaults to |
progress |
Defaults to |
Value
A list of null_cluster_dists
and empirical_clusters
with p-values
See Also
compute_timewise_statistics()
, permute_timewise_statistics()
,
extract_empirical_clusters()
, extract_null_cluster_dists()
,
calculate_clusters_pvalues()
Examples
library(dplyr, warn.conflicts = FALSE)
# Specification object
spec <- make_jlmer_spec(
weight ~ 1 + Diet, filter(ChickWeight, Time <= 20),
subject = "Chick", time = "Time"
)
spec
# Should minimally provide `threshold` and `nsim`, in addition to the spec object
reset_rng_state()
CPA <- clusterpermute(spec, threshold = 2, nsim = 100, progress = FALSE)
CPA
# CPA is a list of `<null_cluster_dists>` and `<empirical_clusters>` objects
sapply(CPA, class)
# You can extract the individual components for further inspection
CPA$null_cluster_dists
CPA$empirical_clusters