Package 'samplesizeestimator'

Title: Calculate Sample Size for Various Scenarios
Description: Calculates sample size for various scenarios, such as sample size to estimate population proportion with stated absolute or relative precision, testing a single proportion with a reference value, to estimate the population mean with stated absolute or relative precision, testing single mean with a reference value and sample size for comparing two unpaired or independent means, comparing two paired means, the sample size For case control studies, estimating the odds ratio with stated precision, testing the odds ratio with a reference value, estimating relative risk with stated precision, testing relative risk with a reference value, testing a correlation coefficient with a specified value, etc. <https://www.academia.edu/39511442/Adequacy_of_Sample_Size_in_Health_Studies#:~:text=Determining%20the%20sample%20size%20for,may%20yield%20statistically%20inconclusive%20results.>.
Authors: R Amala [aut, cre, cph], G Kumarapandiyan [aut], A Srividya [ctb], M Rajeswari [ctb], Ashwani Kumar [ctb]
Maintainer: R Amala <[email protected]>
License: GPL (>= 2)
Version: 1.0.0
Built: 2024-11-04 03:17:49 UTC
Source: https://github.com/cran/samplesizeestimator

Help Index


Sample Size for Testing Correlation Coefficient

Description

Calculates minimum sample size needed to detect at least rho0-rho1 units difference in the hypothesized and reported correlation coefficient for desired level of significance and power

Usage

correl(rho0, rho1, alp, pwr)

Arguments

rho0

magnitude of relationship between the two variables under study, set at null hypothesis

rho1

anticipated magnitude of relationship between the two variables under study

alp

level of significance or accepted level of probability of type I error

pwr

desired level of power

Value

a list object with minimum required sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Bujang, M. A., & Baharum, N. (2016). Sample size guideline for correlation analysis. World Journal of Social Science, 3(1), 37-46.

Examples

correl(rho0 = 0.5, rho1 = 0.7, alp = 0.05, pwr = 0.8)

Sample size for estimating Area Under the ROC curve

Description

Sample size for estimating Area Under the ROC curve

Usage

est.auc(auc, alp, d)

Arguments

auc

anticipated AUC of the diagnostic marker or test

alp

level of significance or accepted level of probability of type I error

d

Precision required on either side of the true AUC

Value

a list of total sample size based on AUC along with reporting

References

Hajian-Tilaki, K. (2014). Sample size estimation in diagnostic test studies of biomedical informatics. Journal of biomedical informatics, 48, 193-204.

Examples

est.auc(auc=0.7,alp=0.05,d=0.07)

Sample size for estimating sensitivity

Description

In diagnostic studies, the test yields a binary outcome and accuracy is evaluated by sensitivity and specificity. This function calculates sample size for estimating sensitivity when the diagnostic test yields a binary outcome.

Usage

est.se(p, se, prec, alp)

Arguments

p

Prevalence of disease

se

anticipated sensitivity of the test

prec

Precision required on either side of the true sensitivity

alp

level of significance or accepted level of probability of type I error

Value

a list of total sample size based on sensitivity along with reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Hajian-Tilaki, K. (2014). Sample size estimation in diagnostic test studies of biomedical informatics. Journal of biomedical informatics, 48, 193-204.

Examples

est.se(p = 0.10, se = 0.99, prec = 0.03, alp = 0.05)

Sample size for estimating single mean

Description

This function computes adequate sample size based on the method of estimating mean with absolute or relative precision. It can be used for descriptive studies where the researcher wishes to describe the distribution of one or more quantitative outcome variables without looking at their causal relationship and hypothesis testing.

Usage

estm(mean, sig, prec, alp, relative = FALSE)

Arguments

mean

anticipated population mean (required if relative precision is desired otherwise not required)

sig

anticipated population standard deviation

prec

desired level of precision on either side of the population mean

alp

level of significance or accepted level of probability of type I error

relative

a logical argument indicating relative or absolute precision (FALSE gives absolute precision)

Value

number needed to estimate mean within the desired precision level

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.

Examples

estm(sig=6.3,prec=1.2,alp=0.05,relative=FALSE)
estm(mean=14,sig=8,prec=0.1,alp=0.05,relative = TRUE)

Sample size for estimation of Odds Ratio with specified precision

Description

Odds ratios are estimated in a case-control study design to assess the association of outcome with past exposure. This function estimates the sample size needed to estimate the true odds ratio with specified precision.

Usage

estor(p0, or, alp, prec, k)

Arguments

p0

Probability of exposure among the controls

or

Anticipated Odds Ratio (OR)

alp

level of significance or probability of claiming the association exists when in fact there is no association

prec

Precision desired on either side of OR

k

the number of controls for each case

Value

a list object, the required minimum sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.

Examples

estor(p0 = 0.35, or = 2, alp = 0.05, prec = 0.25, k = 1)

Sample Size for Estimation of Single Proportion

Description

This function may be used in case of a descriptive study design where the researcher wishes to describe the distribution of one or more categorical outcome variables without looking at their causal relationship and hypothesis testing.

Usage

estp(prop, prec, alp = 0.05, relative = FALSE)

Arguments

prop

Anticipated proportion of outcome or characteristic of interest in the population

prec

Precision required on either side of the population proportion

alp

Level of significance or accepted level of probability of type I error

relative

a logical argument indicating relative or absolute precision (FALSE gives absolute precision)

Value

a list object with minimum required sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.

Examples

estp(prop = 0.8, prec = 0.1, alp = 0.01, relative = FALSE)

Sample size for estimation of Relative Risk

Description

Relative risks are estimated in a cohort study design to assess the association of exposure with the outcome. This function estimates the sample size needed to estimate the true relative risk with specified precision.

Usage

estRR(p0, RR, alp, prec, k)

Arguments

p0

Probability of outcome among unexposed

RR

anticipated Relative Risk (RR)

alp

level of significance or probability of claiming the association exists when in fact there is no association

prec

Precision desired on either side of RR

k

the number of unexposed for each exposed

Value

a list object, the required minimum sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

Examples

estRR(p0=0.2, RR=2, alp=0.05, prec=0.25, k=1)

Sample Size for Estimating LR negative of a Single Diagnostic Test

Description

Calculate sample size(cases) based on negative likelihood ratio an unified index for comparing the accuracy of two diagnostic tests

Usage

LRneg(se, sp, lrneg, alp, pwr, k = 1)

Arguments

se

anticipated sensitivity of the diagnostic test

sp

anticipated specificity of the diagnostic test

lrneg

anticipated LR negative value

alp

level of significance

pwr

desired level of power

k

number of control(s) per case

Value

a list object with minimum required sample size with reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Simel, D.L., Samsa, G.P. Matchar, D. B. (1991). Likelihood ratio with confidence: sample size estimation for diagnostic test studies. J Clin Epidemiol. 44: 763-70.

Examples

LRneg(se=0.9, sp=0.5,lrneg=0.4,alp=0.05, pwr=0.8,k=1)

Sample Size for Estimating LR Positive of a Single Diagnostic Test

Description

Calculate sample size(cases) based on positive likelihood ratio an unified index for comparing the accuracy of two diagnostic tests

Usage

LRpos(se, sp, lrpos, alp, pwr, k = 1)

Arguments

se

anticipated sensitivity of the diagnostic test

sp

anticipated specificity of the diagnostic test

lrpos

anticipated LR positive value

alp

level of significance

pwr

desired level of power

k

number of control(s) per case

Value

a list object with minimum required sample size with reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Simel, D.L., Samsa, G.P. Matchar, D. B. (1991). Likelihood ratio with confidence: sample size estimation for diagnostic test studies. J Clin Epidemiol. 44: 763-70.

Examples

LRpos(se=0.8, sp=0.70,lrpos=2,alp=0.05, pwr=0.8,k=1)

Sample Size for Comparing Independent and dependent means

Description

This function computes the sample size based on three different methods i) comparing mean with a specified value ii) comparing two independent means iii) comparing two dependent means

Usage

n.means(
  delta,
  sd,
  alp = 0.05,
  pwr = 0.8,
  type = "two",
  alternative = "two.sided",
  k = 1,
  paired = FALSE
)

Arguments

delta

anticipated difference between the two groups

sd

anticipated standard deviation

alp

anticipated level of significance or accepted level of type I error alp=0.05 is default

pwr

desired power pwr=0.80 is default

type

string specifying the type of sample (one or two) type=two is default

alternative

one or two sided alternative hypothesis "two.sided" is default

k

the ratio of control to experimental patients k=1 is default

paired

a logical argument indicating whether the sample is independent or dependent FALSE is default

Value

a list object, the required minimum sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.

Examples

n.means(delta = 1.5, sd = 1, alp = 0.05, pwr = 0.9, type ="two",
alternative= "two.sided", k = 1, paired = FALSE)

Estimate sample size for hypothesis testing on proportions

Description

This function computes the sample size based on two different methods i) comparing proportion with a specified (reference) value ii) comparing two independent proportions

Usage

nprop(p1, p2, alp, pwr, type = "two", alternative = "two.sided", k = 1)

Arguments

p1

hypothesized or reported proportion

p2

anticipated proportion in the population of interest

alp

level of significance or accepted level of probability of type I error

pwr

desired level of power

type

character string stating number of groups i.e. one or two (default)

alternative

a character string specifying the alternative hypothesis, must be one of two.sided (default) or one.sided

k

ratio of number of subjects in the two groups k=1 (default)

Value

a list object, the required minimum sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

Examples

nprop(p1=0.5, p2=0.4, alp=0.05, pwr=0.90, type="one",
alternative="one.sided", k=1)
nprop(p1=0.05, p2=0.15, alp=0.05, pwr=0.90, type="two",
alternative="one.sided", k=1)

Sample size for testing Odds Ratio

Description

When we try to associate multiple exposures to an outcome, we need to caluclate the odds ratio (OR) of a particular exposure in the presence of other exposures and test their relative importance in the model using a significance test based on OR. This function computes sample size based on testing OR for a case-control study design

Usage

testor(p0, or, alp, pwr, k)

Arguments

p0

Probability of exposure among the controls

or

Anticipated Odds Ratio

alp

Probability of type I error

pwr

Desired level of power

k

ratio of number of cases to controls to cases

Value

a list object, the required minimum sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

References

Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.

Examples

testor(p0=0.042,or=2.5,alp=0.05,pwr=0.8,k=1)

Sample size for testing relative risk

Description

When we try to associate multiple exposures to an outcome, we need to know the relative risk (RR) of a particular exposure in the presence of other exposures and test their importance in the model using a significance test based on RR. This function computes sample size based on testing RR for a cohort study design.

Usage

testRR(RR, p0, alp, pwr, k = 1)

Arguments

RR

anticipated relative risk

p0

probability of outcome among the unexposed

alp

level of significance or accepted level of probability of type I error

pwr

desired level of power

k

number of unexposed for each exposed

Value

a list object with minimum required sample size along with description for reporting

Author(s)

R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai

Examples

testRR(p0 = 0.2, RR = 1.5, alp = 0.05, pwr = 0.84, k = 1)