# nsim: Compute number of simulations required In rsimsum: Analysis of Simulation Studies Including Monte Carlo Error

## Description

The function `nsim` computes the number of simulations B to perform based on the accuracy of an estimate of interest, using the following equation:

B = [((Z(1 - α / 2) + Z(1 - θ)) σ) / δ] ^ 2

where δ is the specified level of accuracy of the estimate of interest you are willing to accept (i.e. the permissible difference from the true value β), Z(1 - α / 2) is the (1 - α / 2) quantile of the standard normal distribution, Z(1 - θ) is the (1 - θ) quantile of the standard normal distribution with 1 - θ being the power to detect a specific difference from the true value as significant, and σ ^ 2] is the variance of the parameter of interest.

## Usage

 `1` ```nsim(alpha, sigma, delta, power = 0.5) ```

## Arguments

 `alpha` Significance level. Must be a value between 0 and 1. `sigma` Variance for the parameter of interest. Must be greater than 0. `delta` Specified level of accuracy of the estimate of interest you are willing to accept. Must be greater than 0. `power` Power to detect a specific difference from the true value as significant. Must be a value between 0 and 1. Defaults to 0.5, e.g. a power of 50%.

## Value

A scalar value B representing the number of simulations to perform based on the accuracy required.

## References

Burton, A., Douglas G. Altman, P. Royston. et al. 2006. The design of simulation studies in medical statistics. Statistics in Medicine 25: 4279-4292 doi: 10.1002/sim.2673

## Examples

 ```1 2 3 4 5 6 7 8 9``` ```# Number of simulations required to produce an estimate to within 5% # accuracy of the true coefficient of 0.349 with a 5% significance level, # assuming the variance of the estimate is 0.0166 and 50% power: nsim(alpha = 0.05, sigma = sqrt(0.0166), delta = 0.349 * 5 / 100, power = 0.5) # Number of simulations required to produce an estimate to within 1% # accuracy of the true coefficient of 0.349 with a 5% significance level, # assuming the variance of the estimate is 0.0166 and 50% power: nsim(alpha = 0.05, sigma = sqrt(0.0166), delta = 0.349 * 1 / 100, power = 0.5) ```

rsimsum documentation built on May 21, 2021, 5:06 p.m.