aas_tamanho_media: Sample size to estimate a population mean (AAS)

View source: R/cap03-aas.R

aas_tamanho_mediaR Documentation

Sample size to estimate a population mean (AAS)

Description

Computes the sample size needed to estimate a population mean with a given margin of error, choosing automatically between the infinite/unknown-population formula (Eq. 3.15) and the finite-population formula (Eq. 3.37/3.38) depending on whether N is supplied. Extra arguments not needed for the chosen formula are ignored.

Usage

aas_tamanho_media(
  sigma2 = NULL,
  sigma = NULL,
  d,
  conf = 0.95,
  N = NULL,
  perda = 0,
  arredondar = c("cima", "proximo"),
  ...
)

Arguments

sigma2

Population variance (or its estimate). Alternatively supply sigma (standard deviation); if both are given, sigma2 takes precedence.

sigma

Optional population standard deviation, used only if sigma2 is not supplied.

d

Tolerable margin of error (same units as the variable).

conf

Confidence level, default 0.95.

N

Optional population size. If NULL or Inf, the infinite/unknown-population formula (3.15) is used; otherwise the finite-population formula (3.37) is used (cross-checked internally against the algebraically equivalent Eq. 3.38).

perda

Optional flat safety-margin proportion (e.g. 0.25 for a 25% buffer), applied via aas_ajustar_perdas() to inflate the raw sample size (n * (1 + perda), following Example 3.14 of the course notes). Not to be confused with a formal response-rate adjustment (dividing by an expected response rate, Section 4.7.2).

arredondar

Either "cima" (the default – always round up, the conventional, conservative practice in sampling theory, e.g. Cochran 1977) or "proximo" (round to the nearest integer). The course notes round to the nearest integer using a 2-decimal critical value (z = 1.96/1.64); use arredondar = "proximo" together with a matching conf to reproduce the worked examples exactly.

...

Ignored (see package overview on tolerated extra arguments).

Value

A sampling_result object with the required sample size.

References

Cochran, W.G. (1977). Sampling Techniques, 3rd ed. Wiley.

Examples

aas_tamanho_media(sigma = 7, d = 2, conf = 0.95)
aas_tamanho_media(sigma2 = 1240, d = 7, conf = 0.95, N = 10000)

sampleone documentation built on Oct. 13, 2026, 5:07 p.m.