power_t_test_clustered: Power of the adjusted t test for cluster randomized designs

Description Usage Arguments Value See Also Examples

Description

Calculates either the power of the cluster adjusted t test or the value of some other parameter needed to obtain a specified power of the test. The calculated power is only exact, if the design is balanced (same numbers of clusters in each group, and same number of responses in each cluster). See the vignette "Construction of the library functions" for a description of the assumptions and construction of the cluster adjusted t test and how to calculate its power.

Usage

1
2
3
4
5
power_t_test_clustered(clusters_group_1 = NULL,
  clusters_group_2 = clusters_group_1, delta = NULL, sd = NULL,
  rho = NULL, power = NULL, alternative = c("one.sided", "two.sided"),
  sig_level = 0.05, sample_size_calc = FALSE, clusters_pr_group = NULL,
  cluster_size = NULL)

Arguments

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.

power

the power of the cluster adjusted t test.

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.

sample_size_calc

has to be set to TRUE or FALSE to say whether the sample size needed to achieve a certain power should be calculated. This calculation assumes a balanced design. By default, sample_size_calc is FALSE.

clusters_pr_group

the number of clusters in each group. It should only be specified, if sample_size_calc is TRUE, and cluster_size is not specified.

cluster_size

the number of measurements in each cluster. It should only be specified, if sample_size_calc is TRUE, and clusters_pr_group is not specified.

Value

A list

If sample_size_calc is set to FALSE, then one of the parameters delta, sd, rho, power must be left unspecified. The unspecified parameter will then be calculated by the function.

If sample_size_calc is set to TRUE, then all of the parameters delta, sd, rho, power must be specified, but clusters_group_1 and clusters_group_2 must not be specified. On top of that, either clusters_pr_group or cluster_size must be specified. The other one will then be calculated by the function.

Whether or not sample_size_calc is TRUE or FALSE, the function returns a list of all of the arguments to the function and the calculated parameter (the argument left unspecified when calling the function)

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 simulate_power_t_test_clustered for power simulation of the cluster adjusted t test.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#*************************************************************************
# power calculation in balanced design:
power_t_test_clustered(clusters_group_1=c(20,20,20), 
clusters_group_2=c(20,20,20), delta=2,sd=1.5,rho=0.5,alternative="one.sided")

# power calculation in unbalanced design:
power_t_test_clustered(clusters_group_1=c(22,20,24), 
clusters_group_2=c(19,21,20,23), delta=2,sd=1.5,rho=0.5,alternative="one.sided")

# calculation of the minimum treatment effect needed to 
# obtain a power of 0.8:
power_t_test_clustered(clusters_group_1=c(22,20,24), 
clusters_group_2=c(19,21,20,23), sd=1.5, rho=0.5, power=0.8, alternative="one.sided")

# calculation of the needed number of measurements in each cluster
# to obtain a power of 0.8:
power_t_test_clustered(delta=2, sd=1.5, rho=0.5, power=0.8, alternative="one.sided", 
sample_size_calc=TRUE, clusters_pr_group=5)

# calculation of the needed number of clusters in each group 
# to obtain a power of 0.8:
power_t_test_clustered(delta=2, sd=1.5, rho=0.5, power=0.8, alternative="one.sided", 
sample_size_calc=TRUE, cluster_size=10)
#*************************************************************************

AsgerAndersen/t.test.clustered documentation built on May 5, 2019, 8:12 a.m.