table.H2x2Factorial: H2x2Factorial Table

Description Usage Arguments Details Value Examples

View source: R/table.H2x2Factorial.R

Description

The function table.H2x2Factorial outputs a data frame that summarizes the required number of clusters and the predicted power based on a constellation of design parameters. This function is useful when the user wants a series of table-format predictions based on varying design parameters including mean cluster size (m_bar), intraclass correlation coefficient (rho), and coefficient of variation of the cluster sizes (CV).

Usage

1
2
3
4
5
6
7
table.H2x2Factorial(power=0.8, alpha=0.05,
                    pi_x=0.5, pi_z=0.5,
                    delta_x, delta_z, delta_xz, sigma2_y=1,
                    m_bar, CV, rho,
                    estimand="controlled", test="cluster", correction=FALSE,
                    max_n=1e8, seed_mix=NULL, size_mix=1e4,
                    verbose=TRUE)

Arguments

power

a numeric value between 0 and 1 as the desired power level for sample size estimation. Default is 0.8.

alpha

a numeric value between 0 and 1 as the type I error rate. Default is 0.05.

pi_x

a numeric value between 0 and 1 as the proportion of clusters randomized to the cluster-level treatment. Default is 0.5, representing a balanced allocation.

pi_z

a numeric value between 0 and 1 as the proportion of individuals randomized to the individual-level treatment within each cluster. Default is 0.5, representing a balanced allocation.

delta_x

a nonzero numeric value for the (unstandardized) effect size of the marginal cluster-level treatment effect. Default is 0.25, which is the hypothetical value for the example in the referenced paper.

delta_z

a nonzero numeric value for the (unstandardized) effect size of the marginal individual-level treatment effect. Default is 0.33, which is the hypothetical value for the example in the referenced paper.

delta_xz

a nonzero numeric value for the (unstandardized) effect size of the interaction effect of the two treatments. Default is 0.3, which is the hypothetical value for the example in the referenced paper.

sigma2_y

a positive numeric value for the total variance of the continuous outcome. Default is 1.

m_bar

a vector of numeric values larger than 2 for a series of mean cluster sizes.

CV

a vector of positive numeric values for a series of coefficients of variation of the cluster sizes.

rho

a vector of numeric values between 0 and 1 for a series of intraclass correlation coefficients.

estimand

a character argument indicating the type of treatment effect estimand. Supported values include "controlled" (controlled or main effect estimand) and "natural" (natural or marginal effect estimand). Default is "controlled".

test

a character argument indicating the type of hypothesis test of interest. Supported values include "cluster" (test for marginal cluster-level treatment effect), "individual" (test for marginal individual-level treatment effect), "interaction" (interaction test for the two treatments), "joint" (joint test for the two marginal treatment effects), "I-U" (intersection-union test for the two marginal effects). Default is "cluster".

correction

a logical argument indicating whether a finite sample correction should be used. Default is FALSE.

max_n

an optional setting of a maximum number of clusters, which is only functional under test="cluster", "joint", or "I-U". Default is 1e8.

seed_mix

an optional setting of a seed for conducting the simulation-based testing under a mixed distribution, which is only functional under test="joint". Default is NULL.

size_mix

a pre-specified size for the mixed distribution in the simulation-based procedure, which is only needed under test="joint". Default is 1e4.

verbose

a logical argument indicating whether the parameter reiterations and supplementary messages should be presented or suppressed. Default is TRUE.

Details

If the user further requires a vector of power or other parameters like pi_x, which invokes the need for multiple tables, an external loop could be easily written using this function to produce multiple data frames.

Value

table.H2x2Factorial returns a data frame with inputs of m_bar, rho, and CV varied in a factorial setting, the predicted number of clusters n under the power requirement, and the actual power predicted.power the estimated sample size can help to achieve, with some suppressible messages.

Examples

1
2
3
4
5
#Make a result table by providing three mean cluster sizes, three CV, and three ICC
table.cluster <- table.H2x2Factorial(delta_x=0.2, delta_z=0.1,
                                     m_bar=c(10,50,100), CV=c(0, 0.3, 0.5), rho=c(0.01, 0.1),
                                     estimand="controlled", test="cluster", verbose=FALSE)
table.cluster

H2x2Factorial documentation built on July 23, 2021, 5:06 p.m.