permute {crctStepdown} | R Documentation |
Calls lme_permute2 to replicate the permutations
permute(
fitlist,
data,
n_permute = 100,
null_pars = rep(0, length(fitlist)),
cl_var = "cl",
rand_func = NULL
)
fitlist |
A list of glm model objects fitted under the null hypotheses |
data |
A data frame containing the data used to fit the models in fitlist |
n_permute |
Number of permutations to conduct |
null_pars |
A vector of the same length as fitlist specifying the value(s) of the treatment effect parameter(s) under the null hypotheses |
cl_var |
String specifying the name of the column identifying the clusters/cluster-time |
rand_func |
The name of a function that re-randomises the clusters. The function should produce a data frame that identifies the clusters in the treatment group under the new randomisation scheme. The data frame can either have a single column with name cl_var or two columns of cl_var and t identifying the cluster ID and time period a cluster joins the treatment group. If NULL then clusters are randomised in a 1:1 ratio to treatment and control |
An array of dimension length(fitlist)*n_permute containing the test statistics for each model and each iteration
out <- twoarm_sim()
data <- out[[1]]
fit1 <- lme4::glmer(y1 ~ treat + (1|cl) ,
data=data,
family="poisson")
fit2 <- lme4::glmer(y2 ~ treat + (1|cl),
data=data,
family="poisson")
fitlist <- list(fit1,fit2)
nullfitlist <- list()
for(i in 1:length(fitlist)){
nullfitlist[[i]] <- est_null_model(fitlist[[i]],
data,
tr_var = "treat",
null_par = 0)
}
out <- permute(nullfitlist,
data=data,
n_permute = 10,
cl_var = "cl")