lme_permute2 {crctStepdown} R Documentation

## Generate a new permutation

### Description

Returns the test statistic from a specified null hypothesis and model under a single new permutation

### Usage

lme_permute2(
fitlist,
data,
null_par = rep(0, length(fitlist)),
cl_var = "cl",
rand_func = NULL
)


### Arguments

 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 null_par 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 String of 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

### Value

A vector of the length of fitlist with the test statistics for each model and null hypothesis

### Examples

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 <- lme_permute2(nullfitlist,
data=data,
cl_var = "cl")


[Package crctStepdown version 0.2.1 Index]