# calculatePower: Calculate power for micro-randomized trials In MRTSampleSize: A Sample Size Calculator for Micro-Randomized Trials

## Description

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>.

## Usage

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16``` ```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 ) ```

## Arguments

 `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: Constant The proximal treatment effect stays constant over the study. Linear The linearly increasing form of a proximal treatment effect might be used if participants will get more enthusiastically engage in the apps and thus the proximal effect will increase as the study goes. The linearly decreasing form of a proximal treatment effect might be used if participants are likely to disengage the activity suggestionss and thus the proximal effect will decrease as the study goes. Quadratic The quadratic form of a proximal treatment effect might be used if you expect that initially participants will enthusiastically engage in the apps and thus the proximal effect will get higher. Then, as the study goes on, some participants are likely to disengage or begin to ignore the activity suggestions and hence a downward trend. `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: Constant The expected availability stays constant over the study. Linear A linearly increasing pattern of expected availability might be used if participants will find the intervention useful and thus more likely to turn the intervention on. A linearly decreasing pattern of expected availability might be used if participants learn more about the intervetion and get bored through the course of the study and thus getting less likely to turn on the invervention. Quadratic A quadratic pattern of availability. Here the changing point of availability refers to day of either maximal of minimal availability, depending on the input values of initial and average availability. `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.

## Value

The achieved power given the input sample size

## References

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

## Examples

 ``` 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``` ``` 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)#' ```

MRTSampleSize documentation built on Sept. 13, 2020, 5:16 p.m.