Description Usage Arguments Value See Also Examples
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.
1 2 3 4 5 |
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_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
|
sig_level |
the significance level of the t test. If it is not
specified, it has default value |
sample_size_calc |
has to be set to |
clusters_pr_group |
the number of clusters in each group. It should
only be specified, if |
cluster_size |
the number of measurements in each cluster. It should
only be specified, if |
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)
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.
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)
#*************************************************************************
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.