simulate_power_t_test_clustered: Simulated power of the t test for cluster randomized designs

Description Usage Arguments Value See Also Examples

View source: R/power_simulation_t_test_clustered.R

Description

The function simulates num_experiments instances of data according to the model explained in the vignette "Construction of the library functions" with parameters defined by the arguments of the function. For each one of the instances, the function uses the t test for cluster randomized designs to test the null hypothesis that the group means are equal. The function outputs the simulated power of the test, which is the proportion of test rejecting the null hypothesis out of the total number of test.

Usage

1
2
simulate_power_t_test_clustered(num_experiments = 1000, clusters_group_1,
  clusters_group_2, delta, sd, rho, alternative, sig_level = 0.05)

Arguments

num_experiments

is the number of experiments in the simulation.

clusters_group_1

a vector that contains the sizes of the clusters in group 1. If group 1 for instance has one cluster with 10 measurements, and three clusters with 12 measurements each, then we have to set clusters_group_1 to c(10,12,12,12).

clusters_group_2

a vector that contains the sizes of the clusters in group 2.

delta

the difference between the group means (the treatment effect).

sd

the overall standard deviation of the responses, which is assumed to be equal in both groups.

rho

the intracluster correlation coeffiecient, which is assumed to be equal in both groups.

alternative

has to be set to one of two strings, either "one.sided" or "two.sided", to say whether the alternative hypothesis is one-sided or two-sided.

sig_level

the significance level of the t test. If it is not specified, it has default value 0.05.

Value

A number - simulated power of the t test for cluster randomized designs

See Also

t_test_clustered_pval for p value of the cluster adjusted t test, t_test_clustered_stat for value of the cluster adjusted t statistic and power_t_test_clustered for power calculation of the cluster adjusted t test.

Examples

1
2
3
4
5
6
#*************************************************************************
# power simulation
simulate_power_t_test_clustered(num_experiments=1000, clusters_group_1 = c(20,25,15,20), 
                 clusters_group_2=c(15,18,25), delta=2, sd=1.5, rho=0.4, 
                 alternative="one.sided", sig_level=0.05)
#*************************************************************************

AsgerAndersen/t_test_clustered documentation built on May 17, 2019, 5:41 p.m.