Description Usage Arguments Value See Also Examples
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.
1 2 | simulate_power_t_test_clustered(num_experiments = 1000, clusters_group_1,
clusters_group_2, delta, sd, rho, alternative, sig_level = 0.05)
|
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_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
|
sig_level |
the significance level of the t test. If it is not
specified, it has default value |
A number - simulated power of the t test for cluster randomized designs
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.
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)
#*************************************************************************
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.