permute_timewise_statistics {jlmerclusterperm} | R Documentation |
Simulate cluster-mass statistics via bootstrapped permutations
Description
Simulate cluster-mass statistics via bootstrapped permutations
Usage
permute_timewise_statistics(
jlmer_spec,
family = c("gaussian", "binomial"),
statistic = c("t", "chisq"),
nsim = 100L,
predictors = NULL,
...
)
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 |
nsim |
Number of simulations description |
predictors |
(Optional) a subset of predictors to test. Defaults to |
... |
Optional arguments passed to Julia for model fitting.
Defaults to |
Value
A simulation-by-time-by-predictor 3D array of cluster statistics, of class timewise_statistics
.
See Also
Examples
library(dplyr, warn.conflicts = FALSE)
# Specification object
spec <- make_jlmer_spec(
weight ~ 1 + Diet, filter(ChickWeight, Time <= 20),
subject = "Chick", time = "Time"
)
spec
# Simulation x Time x Predictor array of t-statistics from regression output
reset_rng_state()
null_statistics <- permute_timewise_statistics(spec, nsim = 3)
round(null_statistics, 2)
# Collect as dataframe with `tidy()`
permuted_timewise_stats_df <- tidy(null_statistics)
permuted_timewise_stats_df
# Permutations ran under the same RNG state are identical
reset_rng_state()
null_statistics2 <- permute_timewise_statistics(spec, nsim = 3)
identical(null_statistics, null_statistics2)
get_rng_state()
null_statistics3 <- permute_timewise_statistics(spec, nsim = 3)
identical(null_statistics, null_statistics3)
[Package jlmerclusterperm version 1.1.4 Index]