parallel_crt | R Documentation |
Generate a parallel cluster randomised trial design in glmmr
parallel_crt( J, M, t, ratio = 0.5, beta = c(rep(0, t), 0), icc, cac = NULL, iac = NULL, var = 1, family = gaussian() )
J |
Integer indicating the number of sequences such that there are J+1 time periods |
M |
Integer. The number of individual observations per cluster-period, assumed equal across all clusters |
t |
Integer. The number of time periods. |
ratio |
Numeric value indicating the proportion of clusters assigned to treatment. Default is 0.5. |
icc |
Intraclass correlation coefficient. User may specify more than one value, see details. |
cac |
Cluster autocorrelation coefficient, optional and user may specify more than one value, see details |
iac |
Individual autocorrelation coefficient, optional and user may specify more than one value, see details |
var |
Assumed overall variance of the model, used to calculate the other covariance, see details |
family |
a family object |
beta. |
Vector of beta parameters to initialise the design, defaults to all zeros. |
The complete parallel cluster randomised trial design has J clusters observed over T time periods. A proportion ('ratio') of the clusters are assigned to treatment condition for the duration of the trial and the rest are control.
The assumed generalised linear mixed model for the parallel cluster trial is, for individual i, in cluster j, at time t:
y_{ijt} \sim F(μ_{ijt},σ)
μ_{ijt} = h^-1(x_{ijt}β + α_{1j} + α_{2jt} + α_{3i})
α_{p.} \sim N(0,σ^2_p), p = 1,2,3
Defining τ as the total model variance, then the intraclass correlation coefficient (ICC) is
ICC = \frac{σ_1 + σ_2}{τ}
the cluster autocorrelation coefficient (CAC) is :
CAC = \frac{σ_1}{σ_1 + σ_2}
and the individual autocorrelation coefficient as:
IAC = \frac{σ_3}{τ(1-ICC)}
When CAC and/or IAC are not specified in the call, then the respective random effects terms are assumed to be zero. For example, if IAC is not specified then α_{3i} does not appear in the model, and we have a cross-sectional sampling design; if IAC were specified then we would have a cohort.
For non-linear models, such as Poisson or Binomial models, there is no single obvious choice for 'var_par' (τ in the above formulae), as the models are heteroskedastic. Choices might include the variance at the mean values of the parameters or a reasonable choice based on the variance of the respective distribution.
If the user specifies more than one value for icc, cac, or iac, then a DesignSpace is returned with Designs with every combination of parameters. This can be used in particular to generate a design space for optimal design analyses.
A Design object with MeanFunction and Covariance objects, or a DesignSpace holding several such Design objects.
Design, DesignSpace
#generate a simple design with only cluster random effects and 6 clusters in 3 time periods # with 10 individuals in each cluster-period des <- parallel_crt(J=6,M=10,t=3,icc=0.05) # same design but with a cohort of individuals des <- parallel_crt(J=6,M=10,t=3,icc=0.05, iac = 0.1) # same design, but with two clusters per sequence and specifying the initial parameters des <- parallel_crte(J=6,M=10,t=3,beta = c(rnorm(3,0,0.1),-0.1),icc=0.05, iac = 0.1) # specifying multiple values of the variance parameters will return a design space # with all designs with all the combinations of the variance parameter des <- parallel_crt(J=6,M=10,t=3,icc=c(0.01,0.05), cac = c(0.5,0.7,0.9), iac = 0.1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.