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 reatment assignment is included in first level. If a study contains multiple treatments, then mutiple indicators will be used. This function is for designs with 3 arms (i.e., two treatments and a control). Three types of tests are considered in the function: (1) The "main" type tests treatment main effect; (2) The "treatment" type tests the difference between the two treaments; and (3) The "omnibus" type tests whether the three arms are all equivalent. 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. |

`f1` |
Effect size for treatment main effect. Effect size must be positive. |

`f2` |
Effect size for the difference between two treatments. 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. |

`tau` |
Variance of treatment effects across sites/clusters. |

`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 67 68 69 | ```
#To calculate the statistical power given sample size and effect size:
#For main effect
wp.mrt3arm(n = 30, f1 = 0.43, J = 20, tau = 0.4,
sg2 = 2.25, alpha = 0.05, power = NULL)
# Multisite randomized trials with 3 arms
#
# J n f1 tau sg2 power alpha
# 20 30 0.43 0.4 2.25 0.8066964 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt3arm
#For tesing difference between effects
wp.mrt3arm(n = 30, f2 = 0.2, J = 20, tau = 0.4, sg2 = 2.25,
alpha = 0.05, power = NULL, type="treatment")
# Multisite randomized trials with 3 arms
#
# J n f2 tau sg2 power alpha
# 20 30 0.2 0.4 2.25 0.2070712 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt3arm
#For testing site variablity
wp.mrt3arm(n = 30, f1=0.43, f2 = 0.2, J = 20, tau = 0.4, sg2 = 2.25,
alpha = 0.05, power = NULL, type="omnibus")
# Multisite randomized trials with 3 arms
#
# J n f1 f2 tau sg2 power alpha
# 20 30 0.43 0.2 0.4 2.25 0.7950757 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt3arm
#To generate a power curve given a sequence of numbers of sites/clusters:
res <- wp.mrt3arm(n = 30, f2 = 0.2, J = seq(20,120,10), tau = 0.4,
sg2 = 2.25, alpha = 0.05, power = NULL, type="treatment")
res
# Multisite randomized trials with 3 arms
#
# J n f2 tau sg2 power alpha
# 20 30 0.2 0.4 2.25 0.2070712 0.05
# 30 30 0.2 0.4 2.25 0.2953799 0.05
# 40 30 0.2 0.4 2.25 0.3804554 0.05
# 50 30 0.2 0.4 2.25 0.4603091 0.05
# 60 30 0.2 0.4 2.25 0.5337417 0.05
# 70 30 0.2 0.4 2.25 0.6001544 0.05
# 80 30 0.2 0.4 2.25 0.6593902 0.05
# 90 30 0.2 0.4 2.25 0.7116052 0.05
# 100 30 0.2 0.4 2.25 0.7571648 0.05
# 110 30 0.2 0.4 2.25 0.7965644 0.05
# 120 30 0.2 0.4 2.25 0.8303690 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt3arm
#To plot the power curve:
plot(res)
#To calculate the required sample size given power and effect size:
wp.mrt3arm(n = NULL, f1 = 0.43, J = 20, tau = 0.4,
sg2 = 2.25, alpha = 0.05, power = 0.8)
# Multisite randomized trials with 3 arms
#
# J n f1 tau sg2 power alpha
# 20 28.61907 0.43 0.4 2.25 0.8 0.05
#
# NOTE: n is the number of subjects per cluster
# URL: http://psychstat.org/mrt3arm
``` |

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.