beales | R Documentation |
Beale's ratio estimator \insertCiteBeale_1962funtimes
for estimating population total and
confidence intervals, with an option of calculating sample size for a required
relative error (p
) or margin of error (d
).
beales(x, y, level = 0.95, N = NULL, p = NULL, d = NULL, verbose = TRUE)
x |
a numeric vector with quantities of interest, such as river discharge
per month. Missing values ( |
y |
a numeric vector with quantities of interest for which the total shall
be estimated, such as total nutrient loads per month.
Missing values ( |
level |
confidence level, from 0 to 1.
Default is |
N |
population size for which the estimate of the total |
p |
optional argument specifying the required relative error, from 0 to 1,
for computing the corresponding sample size. For example, |
d |
optional argument specifying the required margin of error
for computing the corresponding sample size. If both |
verbose |
logical value defining whether the output should be printed out
in words. Default is set to |
A list with the following components:
estimate |
Beale's estimate of the population total for the variable |
se |
standard error of the estimate. |
CI |
a vector of length 2 with a confidence interval (lower and upper value) for the estimate. |
level |
confidence level for the interval. |
N |
population size. |
n |
the actual sample size. |
p |
the relative error used for sample size calculations.
Reported only if |
d |
the margin of error used for sample size calculations.
Reported only if |
nhat |
estimated sample size for the given |
Vyacheslav Lyubchich, thanks to Dave Lorenz for pointing out an error in version 7 and below of the package
vignette("beales", package = "funtimes")
#Some hypothetical data for monthly river discharge
#and corresponding nutrient loads:
discharge <- c(NA, 50, 90, 100, 80, 90, 100, 90, 80, 70, NA, NA)
loads <- c(33, 22, 44, 48, NA, 44, 49, NA, NA, 36, NA, NA)
#Example 1:
#Estimate total annual load (12 months),
#with 90% confidence intervals
beales(discharge, loads, level = 0.9)
#Example 2:
#Calculate sample size required for 90% confidence intervals
#with a margin of error 30 units
beales(discharge, loads, level = 0.9, d = 30)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.