Description Usage Arguments Details Value See Also Examples
View source: R/finite_pop_sampling.R
Estimate distribution of true positives given sampling resuts
1 2 3 4 | truepos_given_sample(samplepos, n, N, replicates = 1000)
## S3 method for class 'truepos'
summary(object, alpha = 0.1, ...)
|
samplepos |
Number of positives observed in sample |
n |
Sample size |
N |
Population size |
replicates |
Number of replicates per tested true pos number |
object |
Sample counts to summarise |
alpha |
The confidence interval is (1-alpha)*100% (i.e. alpha=0.1 => 90% CI) |
... |
Additional arguments (currently ignored) |
The idea is to generate random realisations for all possible numbers of true positives, choose only those cases that resulted in the observed number of sample positives, and then use that empirical distribution of simulated true positives to estimate the most likely value of the (unknown) number of true positives.
NB what we are doing here effectively is to estimate the unknown parameter,
m
, of the Hypergeometric
distribution, i.e.
the number of white balls in the urn.
a vector containing population true positive counts that could have
generated the observed number of sample positives. It has class
truepos
.
Other population-sampling: prop.ci
,
required.sample.size
,
sample_finite_population
1 2 3 4 5 6 7 8 9 10 11 | # Imagine we have sampled 10 profiles from a tract of 48 and found 2 LHNs
tps=truepos_given_sample(samplepos = 2, n=10, N=48)
hist(tps, breaks=0:49-.5, col='red')
plot(ecdf(tps))
# the mode should be the Maximum Likelihood Estimate
# (if enough replicates were used)
summary(tps)
# 95% confidence interval
summary(tps, alpha=.05)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.