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 |
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
correl(rho0, rho1, alp, pwr)
correl(rho0, rho1, alp, pwr)
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 |
a list object with minimum required sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Bujang, M. A., & Baharum, N. (2016). Sample size guideline for correlation analysis. World Journal of Social Science, 3(1), 37-46.
correl(rho0 = 0.5, rho1 = 0.7, alp = 0.05, pwr = 0.8)
correl(rho0 = 0.5, rho1 = 0.7, alp = 0.05, pwr = 0.8)
Sample size for estimating Area Under the ROC curve
est.auc(auc, alp, d)
est.auc(auc, alp, d)
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 |
a list of total sample size based on AUC along with reporting
Hajian-Tilaki, K. (2014). Sample size estimation in diagnostic test studies of biomedical informatics. Journal of biomedical informatics, 48, 193-204.
est.auc(auc=0.7,alp=0.05,d=0.07)
est.auc(auc=0.7,alp=0.05,d=0.07)
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.
est.se(p, se, prec, alp)
est.se(p, se, prec, alp)
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 |
a list of total sample size based on sensitivity along with reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Hajian-Tilaki, K. (2014). Sample size estimation in diagnostic test studies of biomedical informatics. Journal of biomedical informatics, 48, 193-204.
est.se(p = 0.10, se = 0.99, prec = 0.03, alp = 0.05)
est.se(p = 0.10, se = 0.99, prec = 0.03, alp = 0.05)
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.
estm(mean, sig, prec, alp, relative = FALSE)
estm(mean, sig, prec, alp, relative = FALSE)
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 ( |
number needed to estimate mean within the desired precision level
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.
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)
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)
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.
estor(p0, or, alp, prec, k)
estor(p0, or, alp, prec, k)
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 |
a list object, the required minimum sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.
estor(p0 = 0.35, or = 2, alp = 0.05, prec = 0.25, k = 1)
estor(p0 = 0.35, or = 2, alp = 0.05, prec = 0.25, k = 1)
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.
estp(prop, prec, alp = 0.05, relative = FALSE)
estp(prop, prec, alp = 0.05, relative = FALSE)
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 ( |
a list object with minimum required sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.
estp(prop = 0.8, prec = 0.1, alp = 0.01, relative = FALSE)
estp(prop = 0.8, prec = 0.1, alp = 0.01, relative = FALSE)
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.
estRR(p0, RR, alp, prec, k)
estRR(p0, RR, alp, prec, k)
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 |
a list object, the required minimum sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
estRR(p0=0.2, RR=2, alp=0.05, prec=0.25, k=1)
estRR(p0=0.2, RR=2, alp=0.05, prec=0.25, k=1)
Calculate sample size(cases) based on negative likelihood ratio an unified index for comparing the accuracy of two diagnostic tests
LRneg(se, sp, lrneg, alp, pwr, k = 1)
LRneg(se, sp, lrneg, alp, pwr, k = 1)
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 |
a list object with minimum required sample size with reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
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.
LRneg(se=0.9, sp=0.5,lrneg=0.4,alp=0.05, pwr=0.8,k=1)
LRneg(se=0.9, sp=0.5,lrneg=0.4,alp=0.05, pwr=0.8,k=1)
Calculate sample size(cases) based on positive likelihood ratio an unified index for comparing the accuracy of two diagnostic tests
LRpos(se, sp, lrpos, alp, pwr, k = 1)
LRpos(se, sp, lrpos, alp, pwr, k = 1)
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 |
a list object with minimum required sample size with reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
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.
LRpos(se=0.8, sp=0.70,lrpos=2,alp=0.05, pwr=0.8,k=1)
LRpos(se=0.8, sp=0.70,lrpos=2,alp=0.05, pwr=0.8,k=1)
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
n.means( delta, sd, alp = 0.05, pwr = 0.8, type = "two", alternative = "two.sided", k = 1, paired = FALSE )
n.means( delta, sd, alp = 0.05, pwr = 0.8, type = "two", alternative = "two.sided", k = 1, paired = FALSE )
delta |
anticipated difference between the two groups |
sd |
anticipated standard deviation |
alp |
anticipated level of significance or accepted level of type I error |
pwr |
desired power |
type |
string specifying the type of sample (one or two) |
alternative |
one or two sided alternative hypothesis |
k |
the ratio of control to experimental patients |
paired |
a logical argument indicating whether the sample is independent or dependent |
a list object, the required minimum sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.
n.means(delta = 1.5, sd = 1, alp = 0.05, pwr = 0.9, type ="two", alternative= "two.sided", k = 1, paired = FALSE)
n.means(delta = 1.5, sd = 1, alp = 0.05, pwr = 0.9, type ="two", alternative= "two.sided", k = 1, paired = FALSE)
This function computes the sample size based on two different methods i) comparing proportion with a specified (reference) value ii) comparing two independent proportions
nprop(p1, p2, alp, pwr, type = "two", alternative = "two.sided", k = 1)
nprop(p1, p2, alp, pwr, type = "two", alternative = "two.sided", k = 1)
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. |
alternative |
a character string specifying the alternative hypothesis, must be one of |
k |
ratio of number of subjects in the two groups |
a list object, the required minimum sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
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)
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)
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
testor(p0, or, alp, pwr, k)
testor(p0, or, alp, pwr, k)
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 |
a list object, the required minimum sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
Lwanga, S. K., Lemeshow, S., & World Health Organization. (1991). Sample size determination in health studies: a practical manual. World Health Organization.
testor(p0=0.042,or=2.5,alp=0.05,pwr=0.8,k=1)
testor(p0=0.042,or=2.5,alp=0.05,pwr=0.8,k=1)
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.
testRR(RR, p0, alp, pwr, k = 1)
testRR(RR, p0, alp, pwr, k = 1)
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 |
a list object with minimum required sample size along with description for reporting
R. Amala, Scientist-C, ICMR-VCRC, Puducherry & G. Kumarapandiyan, Asst. Prof., Madras Christian College, Chennai
testRR(p0 = 0.2, RR = 1.5, alp = 0.05, pwr = 0.84, k = 1)
testRR(p0 = 0.2, RR = 1.5, alp = 0.05, pwr = 0.84, k = 1)