incpower: Power and Required Sample Size

Description Usage Arguments Details Value Examples

View source: R/power.R

Description

Calculate power and required sample size for a given power to detect incidence change.

Usage

1
2
3
4
5
incpower(I1, I2, PrevH1, PrevH2, n1 = "both", n2 = "both",
  alpha = 0.05, Power = 0.8, SS = "out", CR = 1, DE_H = 1,
  DE_R = 1, BMest = "same.test", MDRI, RSE_MDRI, FRR, RSE_FRR,
  BigT = 730, Boot = FALSE, BS_Count = 1e+05, Cov.PrevH.I = c(0,
  0), debug = FALSE)

Arguments

I1

Predicted incidence of HIV in survey 1.

I2

Predicted incidence of HIV in survey 2.

PrevH1

Predicted prevalence of HIV in survey 1.

PrevH2

Predicted prevalence of HIV in survey 2.

n1

Sample size for survey 1. If equal sample sizes for both surveys are desired at a given power level, both n1 and n2 must have value 'both', which is the default.

n2

Sample size for survey 2. If equal sample sizes for both surveys are desired at a given power level, both n1 and n2 must have value 'both', which is the default.

alpha

Significance level for test (default alpha=0.05).

Power

Desired power used to calculate a sample size for the surveys. Default is 0.80, meaning the function outputs the necessary sample size to achieve stated power for a test of differences in incidence. If Power is set to 'out', function will return power of detecting a difference in incidences for given sample size inputs.

SS

Sample size. Default is 'out', meaning the function takes a power argument and outputs a common sample size needed to achieve power level for test of differences for incidence. If power is desired for a given sample size, parameter value is irrelevant; however, values for n1 and n2 must be specified.

CR

Coverage rate (0-1).

DE_H

Design effect of HIV prevalence test (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

DE_R

Design effect of recency test (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

BMest

Biomarker test parameter (MDRI, FRR, and RSE) estimation by one the 3 options 'same.test'(default), 'FRR.indep', 'MDRI.FRR.indep' (string).

MDRI

mean duration of recent infection [days] (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

RSE_MDRI

Relative standard error of MDRI [days] (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

FRR

False recent rate (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

RSE_FRR

Relative standard error of FRR (vector/integer). If a single value is specified, that value is assumed to be the value for both surveys.

BigT

Post-infection time cut-off (days). Default 730. If a single value is specified, that value is assumed to be the value for both surveys.

Boot

True/False variable indicating whether variance of point estimates is to be calculated by Empirical Bootstrapping (TRUE) or Delta Method (FALSE), the default setting.

BS_Count

Specifies number of bootstrap samples for bootstrapped confidence intervals of incidence.

Cov.PrevH.I

Covariance of prevalence and incidence for bootstrap resampling.

debug

Enable debugging mode (browser)

Details

The package contains long form documentation in the form of vignettes that cover the use of the main fucntions. Use browseVignettes(package="inctools") to access them.

Value

Common sample size of two surveys–or the sample size of one survey given the other has already been completed–necessary to achieve a given power level for testing a null hypothesis that the incidence rates are identical between populations; alternatively, the power of said test under a particular sample size scenario. Function also returns implied statistics from input values on paramters, confidence limits, and population counts.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
incpower(I1 = 0.05, I2 = 0.03, PrevH1 = 0.20, PrevH2 = 0.20,
n1 = 5000, n2 = 5000, alpha = 0.05, Power = "out", SS = NULL,
DE_H = c(1,1.1), DE_R = 1, BMest = 'same.test', MDRI = 200,
RSE_MDRI = 0.05, FRR = 0.01, RSE_FRR = 0.20, BigT = 730)


incpower(I1 = 0.05, I2 = 0.03, PrevH1 = 0.20, PrevH2 = 0.20,
alpha = 0.05, Power = 0.80, SS = "out", DE_H = 1, DE_R = 1,
BMest = 'FRR.indep', MDRI = 200, RSE_MDRI = 0.05,
FRR = c(0.01,0.009), RSE_FRR = c(0.20,0.21), BigT = 730)

Example output

$Inc.Difference.Statistics
  deltaI_Est RSE_deltaI RSE_deltaI.infSS     Power Power.infSS      CI.low
1       0.02  0.3303751       0.05244431 0.8569912       >0.99 0.007049534
       CI.up
1 0.03295047

$Implied.Incidence.Statistics
  Survey Given.I     RSE_I     CI.low      CI.up
1      1    0.05 0.1151054 0.03871987 0.06128013
2      2    0.03 0.1469490 0.02135956 0.03864044

$Implied.MDRI.Statistics
  Given.MDRI CI.low CI.up
1        200  180.4 219.6

$Implied.FRR.Statistics
  Given.FRR CI.low CI.up
1      0.01  0.006 0.014

$Implied.Subject.Counts
                           Survey.1 Survey.2
HIV.negative                   4000     4000
HIV.positive                   1000     1000
HIV.post.tested.for.recent     1000     1000
Recency.test.pos                116       73

$Minimum.Common.SS
[1] 4297

$Inc.Difference.Statistics
  deltaI_Est RSE_deltaI RSE_deltaI.infSS     Power Power.infSS     CI.low
1       0.02  0.3569374       0.06842988 0.8000074       >0.99 0.00600831
       CI.up
1 0.03399169

$Implied.Incidence.Statistics
  Survey Given.I     RSE_I     CI.low      CI.up
1      1    0.05 0.1222911 0.03801569 0.06198431
2      2    0.03 0.1549998 0.02088618 0.03911382

$Implied.MDRI.Statistics
  Given.MDRI CI.low CI.up
1        200  180.4 219.6

$Implied.FRR.Statistics
  Given.FRR CI.low  CI.up
1     0.010 0.0061 0.0139
2     0.009 0.0053 0.0127

$Implied.Subject.Counts
                           Survey.1 Survey.2
HIV.negative                   3438     3438
HIV.positive                    859      859
HIV.post.tested.for.recent      859      859
Recency.test.pos                 99       62

inctools documentation built on Nov. 7, 2019, 5:07 p.m.