Description Usage Arguments Value References Examples

Multisite randomized trials (MRT) are a type of multilevel design for the situation when the entire cluster is randomly assigned to either a treatment arm or a contral arm (Liu, 2013). The data from MRT can be analyzed in a two-level hierachical linear model, where the indicator variable for treatment assignment is included in first level. If a study contains multiple treatments, then mutiple indicators will be used. This function is for designs with 2 arms (i.e., a treatment and a control). Three types of tests are considered in the function: (1) The "main" type tests treatment main effect; (2) The "site" type tests the variance of cluster/site means; and (3) The "variance" type tests variance of treatment effects. Details leading to power calculation can be found in Raudenbush (1997) and Liu (2013).

1 2 3 |

`n` |
Sample size. It is the number of individuals within each cluster. |

`f` |
Effect size. It specifies the main effect of treatment, the mean difference between the treatment clusters/sites and the control clusters/sites. Effect size must be positive. |

`J` |
Number of clusters / sites. It tells how many clusters are considered in the study design. At least two clusters are required. |

`tau00` |
Variance of cluster/site means. It is one of the residual variances in the second level. Its value must be positive. |

`tau11` |
Variance of treatment effects across sites. It is one of the residual variances in the second level. Its value must be positive. |

`sg2` |
Level-one error Variance. The residual variance in the first level. |

`power` |
Statistical power. |

`alpha` |
significance level chosed for the test. It equals 0.05 by default. |

`alternative` |
Type of the alternative hypothesis ( |

`type` |
Type of effect ( |

An object of the power analysis.

Liu, X. S. (2013). Statistical power analysis for the social and behavioral sciences: basic and advanced techniques. Routledge.

Raudenbush, S. W. (1997). Statistical analysis and optimal design for cluster randomized trials. Psychological Methods, 2(2), 173.

Zhang, Z., & Yuan, K.-H. (2018). Practical Statistical Power Analysis Using Webpower and R (Eds). Granger, IN: ISDSA Press.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | ```
#To calculate the statistical power given sample size and effect size:
#For main effect
wp.mrt2arm(n = 45, f = 0.5, J = 20, tau11 = 0.5,
sg2 = 1.25, alpha = 0.05, power = NULL)
# Power analysis for Multileve model Multisite randomized trials with 2 arms
#
# J n f tau11 sg2 power alpha
# 20 45 0.5 0.5 1.25 0.8583253 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt2arm
#For variance of treament effect
wp.mrt2arm(n = 45, f = 0.5, J = 20, tau11 = 0.5,
sg2 = 1.25, alpha = 0.05, power = NULL, type = "variance")
# Power analysis for Multileve model Multisite randomized trials with 2 arms
#
# J n f tau11 sg2 power alpha
# 20 45 0.5 0.5 1.25 0.9987823 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt2arm
#For testing site variablity
res<- wp.mrt2arm(n = 45, f = 0.5, J = 20, tau11 = 0.5,
sg2 = 1.25, alpha = 0.05, power = NULL, type = "site")
# Power analysis for Multileve model Multisite randomized trials with 2 arms
#
# J n f tau11 sg2 alpha
# 20 45 0.5 0.5 1.25 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt2arm
#To generate a power curve given a sequence of sample sizes:
wp.mrt2arm(n = seq(10,50,5), f = 0.5, J = 20, tau11 = 0.5,
sg2 = 1.25, alpha = 0.05, power = NULL)
# Power analysis for Multileve model Multisite randomized trials with 2 arms
#
# J n f tau11 sg2 power alpha
# 20 10 0.5 0.5 1.25 0.6599499 0.05
# 20 15 0.5 0.5 1.25 0.7383281 0.05
# 20 20 0.5 0.5 1.25 0.7818294 0.05
# 20 25 0.5 0.5 1.25 0.8090084 0.05
# 20 30 0.5 0.5 1.25 0.8274288 0.05
# 20 35 0.5 0.5 1.25 0.8406659 0.05
# 20 40 0.5 0.5 1.25 0.8506049 0.05
# 20 45 0.5 0.5 1.25 0.8583253 0.05
# 20 50 0.5 0.5 1.25 0.8644864 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt2arm
#To plot the power curve:
plot(res)
#To calculate the required sample size given power and effect size:
wp.mrt2arm(n = NULL, f = 0.5, J = 20, tau11 = 0.5,
sg2 = 1.25, alpha = 0.05, power = 0.8)
# Power analysis for Multileve model Multisite randomized trials with 2 arms
#
# J n f tau11 sg2 power alpha
# 20 23.10086 0.5 0.5 1.25 0.8 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt2arm
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.