Title: | A Sample Size Calculator for Micro-Randomized Trials |
---|---|
Description: | Provide a sample size calculator for micro-randomized trials (MRTs) based on methodology developed in Sample Size Calculations for Micro-randomized Trials in mHealth by Liao et al. (2016) <DOI:10.1002/sim.6847>. |
Authors: | Peng Liao [aut, cre], Liying Huang [aut], Nicholas J. Seewald [aut], Ji Sun [aut] |
Maintainer: | Peng Liao <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.3.0 |
Built: | 2025-03-13 02:44:20 UTC |
Source: | https://github.com/cran/MRTSampleSize |
This function calculates power for micro-randomized trials (MRTs) based on methodology developed in Sample Size Calculations for Micro-randomized Trials in mHealth by Liao et al. (2016) <DOI:10.1002/sim.6847>.
calculatePower( days, occ_per_day, prob, beta_shape, beta_mean, beta_initial, beta_quadratic_max, tau_shape, tau_mean, tau_initial, tau_quadratic_max, dimB, sample_size, sigLev )
calculatePower( days, occ_per_day, prob, beta_shape, beta_mean, beta_initial, beta_quadratic_max, tau_shape, tau_mean, tau_initial, tau_quadratic_max, dimB, sample_size, sigLev )
days |
The duration of the study. |
occ_per_day |
The number of decision time points per day. |
prob |
The randomization probability, i.e. the probability of assigning the treatment at a decision time point. This can be constant, or time-varying probabilities can be specified by a vector specifying randomization probabilities for each day or decision time. |
beta_shape |
The trend for the proximal treatment effect, choices are constant, linear or quadratic. Note:
|
beta_mean |
The average of proximal treatment effect. |
beta_initial |
The initial value of proximal treatment effect when beta_shape is linear or quadratic. |
beta_quadratic_max |
The day of maximal proximal treatment effect when beta_shape is quadratic. |
tau_shape |
The pattern for expected availability; choices can be constant, linear or quadratic. Note:
|
tau_mean |
The average of expected availability. |
tau_initial |
The initial Value of expected availability when tau_shape is linear or quadratic. |
tau_quadratic_max |
The changing point of availability when tau_shape is quadratic. |
dimB |
The number of parameters used in the main/average effect of proximal outcome |
sample_size |
The number of participants |
sigLev |
The significance level or type I error rate. |
The achieved power given the input sample size
Seewald, N.J.; Sun, J.; Liao, P. "MRT-SS Calculator: An R Shiny Application for Sample Size Calculation in Micro-Randomized Trials". arXiv:1609.00695
calculatePower(days=42, occ_per_day=5, prob=0.4, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, sample_size=40, sigLev=0.05) prob1 <- c(replicate(35,0.7),replicate(35,0.6),replicate(35,0.5),replicate(35,0.4)) calculatePower(days=28, occ_per_day=5, prob=prob1, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, sample_size=40, sigLev=0.05)#'
calculatePower(days=42, occ_per_day=5, prob=0.4, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, sample_size=40, sigLev=0.05) prob1 <- c(replicate(35,0.7),replicate(35,0.6),replicate(35,0.5),replicate(35,0.4)) calculatePower(days=28, occ_per_day=5, prob=prob1, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, sample_size=40, sigLev=0.05)#'
This function calculates the sample size for micro-randomized trials (MRTs) based on methodology developed in Sample Size Calculations for Micro-randomized Trials in mHealth by Liao et al. (2016) <DOI:10.1002/sim.6847>.
calculateSampleSize( days, occ_per_day, prob, beta_shape, beta_mean, beta_initial, beta_quadratic_max, tau_shape, tau_mean, tau_initial, tau_quadratic_max, dimB, power, sigLev )
calculateSampleSize( days, occ_per_day, prob, beta_shape, beta_mean, beta_initial, beta_quadratic_max, tau_shape, tau_mean, tau_initial, tau_quadratic_max, dimB, power, sigLev )
days |
The duration of the study. |
occ_per_day |
The number of decision time points per day. |
prob |
The randomization probability, i.e. the probability of assigning the treatment at a decision time point. This can be constant, or time-varying probabilities can be specified by by a vector specifying randomization probabilities for each day or decision time. |
beta_shape |
The trend for the proximal treatment effect; choices are constant, linear or quadratic. Note:
|
beta_mean |
The average of proximal treatment effect. |
beta_initial |
The initial value of proximal treatment effect when beta_shape is linear or quadratic. |
beta_quadratic_max |
Day of maximal proximal treatment effect when beta_shape is quadratic. |
tau_shape |
The pattern for expected availability; choices are constant, linear or quadratic. Note:
|
tau_mean |
The average of expected availability. |
tau_initial |
The initial Value of expected availability when tau_shape is linear or quadratic. |
tau_quadratic_max |
The changing point of availability when tau_shape is quadratic. |
dimB |
The number of parameters used in the main/average effect of proximal outcome. |
power |
The desired power to achieve. |
sigLev |
The significance level or type I error rate. |
The minimal sample size to achieve the desired power.
Seewald, N.J.; Sun, J.; Liao, P. "MRT-SS Calculator: An R Shiny Application for Sample Size Calculation in Micro-Randomized Trials". arXiv:1609.00695
calculateSampleSize(days=42, occ_per_day=5, prob=0.4, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, power=0.8, sigLev=0.05) prob1 <- c(replicate(35,0.7),replicate(35,0.6),replicate(35,0.5),replicate(35,0.4)) calculateSampleSize(days=28, occ_per_day=5, prob=prob1, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, power=0.8, sigLev=0.05)
calculateSampleSize(days=42, occ_per_day=5, prob=0.4, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, power=0.8, sigLev=0.05) prob1 <- c(replicate(35,0.7),replicate(35,0.6),replicate(35,0.5),replicate(35,0.4)) calculateSampleSize(days=28, occ_per_day=5, prob=prob1, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42, dimB=3, power=0.8, sigLev=0.05)
plot of the graphs for the expected availability, i.e., the expected probability that a participant is available to receive treatment at a decision time. when the pattern for the expected availability is constant, linear or quadractic.
plotExpectAvail( days, occ_per_day, tau_shape, tau_mean, tau_initial, tau_quadratic_max )
plotExpectAvail( days, occ_per_day, tau_shape, tau_mean, tau_initial, tau_quadratic_max )
days |
Duration of the study. |
occ_per_day |
Number of decision time points per day. |
tau_shape |
The pattern for expected availability, choices are constant, linear or quadratic. Note:
|
tau_mean |
Average of expected availability. |
tau_initial |
Initial Value of expected availability when tau_shape is linear or quadratic. |
tau_quadratic_max |
Changing point of availability when tau_shape is quadratic. |
A graph for expected availability.
plotExpectAvail(days=42, occ_per_day=5, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42)
plotExpectAvail(days=42, occ_per_day=5, tau_shape="quadratic", tau_mean=0.5, tau_initial=0.7, tau_quadratic_max=42)
plot of the graphs for the proximal treatment effect when the trend for the proximal treatment effect is constant, linear or quadractic.
plotProximalEffect( days, occ_per_day, beta_shape, beta_mean, beta_initial, beta_quadratic_max )
plotProximalEffect( days, occ_per_day, beta_shape, beta_mean, beta_initial, beta_quadratic_max )
days |
Duration of the study. |
occ_per_day |
Number of decision time points per day. |
beta_shape |
The trend for the proximal treatment effect, choices are constant, linear or quadratic. Note:
|
beta_mean |
Average of proximal treatment effect. |
beta_initial |
Initial value of proximal treatment effect when beta_shape is linear or quadratic. |
beta_quadratic_max |
Day of maximal proximal treatment effect when beta_shape is quadratic. |
A graph for the proximal treatment effect.
plotProximalEffect(days=42, occ_per_day=5, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28)
plotProximalEffect(days=42, occ_per_day=5, beta_shape="quadratic", beta_mean=0.1, beta_initial=0, beta_quadratic_max=28)