Resource assessment exercises: required sample size determination
From AWF-Wiki
- This article is part of the Resource assessment exercises. See the category page for a (chronological) table of contents.
Previously we took a sample S
of size \(n=50\).
S ## [1] 22 8 18 43 21 44 17 25 32 10 11 17 9 10 56 14 14 10 20 8 37 14 55 29 33 ## [26] 17 10 15 29 8 21 9 9 24 21 28 19 58 16 16 15 20 5 9 14 30 11 9 12 27
The width of the confidence interval was,
sd(S)/sqrt(n) * qt(0.975, n - 1) * 2 ## [1] 7.364
Suppose a confidence interval of \(A=3\) cm is desired. How large should the sample size, \(n\), be? This can be estimated,
$A=t_{\alpha,n-1}\frac{s}{\sqrt{n} }\rightarrow n=\frac{t_{\alpha, n-1}^2s^2}{A^2}$ | 1 |
We will use the sample S
(\(n=50\)) to estimate how many observations we need in our sample.
In R:
half.A <- 1.5 req.n <- (qt(0.975, n - 1)^2 * var(S))/half.A^2 req.n ## [1] 301.2
We always need to round up!
req.n <- ceiling(req.n)
- What the function
ceiling()
does - The function
ceiling()
ceiling takes a single numeric argumentx
and returns a numeric vector containing the smallest integers not less than the corresponding elements ofx
E.g., 4.3 becomes 5. See alsoround()
.
We estimate the width of the confidence interval using the new sample size of \(n=302\).
s.req.n <- sample(trees$dbh, req.n) sd(s.req.n)/sqrt(req.n) * qt(0.975, req.n - 1) * 2 ## [1] 2.759
Related articles
- Previous article: Finite population correction
- Next article: Estimating a proportion