Skip to contents

Compute the sampling error (SE, margin of error, CV) for estimating a population mean given a sample size. This is the inverse of n_mean().

Usage

prec_mean(var, ...)

# Default S3 method
prec_mean(
  var,
  n,
  mu = NULL,
  alpha = 0.05,
  N = Inf,
  deff = 1,
  resp_rate = 1,
  ...
)

# S3 method for class 'svyplan_n'
prec_mean(var, ...)

Arguments

var

For the default method: population variance \(S^2\). For svyplan_n objects: a sample size result from n_mean().

...

Additional arguments passed to methods.

n

Sample size.

mu

Population mean magnitude (positive). Required for the CV component.

alpha

Significance level, default 0.05.

N

Population size. Inf (default) means no finite population correction.

deff

Design effect multiplier (> 0). Values < 1 are valid for efficient designs (e.g., stratified sampling with Neyman allocation).

resp_rate

Expected response rate, in (0, 1]. Default 1 (no adjustment). The effective sample size is deflated by resp_rate.

Value

A svyplan_prec object with components $se, $moe, and $cv. $cv is NA when mu is not provided.

Details

Computes the standard error for the given sample size and design parameters, then derives the margin of error and coefficient of variation. The effective sample size is n * resp_rate / deff, with optional finite population correction.

See also

n_mean() for the inverse (compute n from a precision target), prec_prop() for proportions.

Examples

# Precision with n = 400
prec_mean(var = 100, n = 400, mu = 50)
#> Sampling precision for mean
#> n = 400
#> se = 0.5000, moe = 0.9800, cv = 0.0100

# Without mu (CV will be NA)
prec_mean(var = 100, n = 400)
#> Sampling precision for mean
#> n = 400
#> se = 0.5000, moe = 0.9800