razao_vs_regressao_decidir: Ratio vs. regression: full side-by-side comparison (umbrella...

View source: R/cap07-tamanho-guarda-chuva.R

razao_vs_regressao_decidirR Documentation

Ratio vs. regression: full side-by-side comparison (umbrella function)

Description

Convenience "umbrella" function that fits the regression model, tests whether the line passes through the origin, and computes both the ratio and the regression estimators of the population mean side by side, clearly flagging which one the origin test recommends – following the full workflow of Examples 7.1-7.2 of the course notes. This lets students and instructors compare both estimators even when only one is formally "correct" for the data at hand.

Usage

razao_vs_regressao_decidir(x, y, X_barra, N, conf = 0.95, ...)

Arguments

x

Numeric vector with the auxiliary variable.

y

Numeric vector with the variable of interest.

X_barra

Known population mean of the auxiliary variable (required for the regression estimator; not required for the ratio estimator, whose mean form only needs N).

N

Population size.

conf

Confidence level, default 0.95.

...

Ignored. Any other variables from a broader problem statement may be passed here without causing an error.

Details

The function itself does not write anything to the console; print the returned object (or just type its name) to see a side-by-side summary.

Value

An object of class razao_vs_regressao: a named list with elements teste (from reg_teste_origem()), razao (from razao_estima_media()), and regressao (from reg_estima_media()), plus a recomendado character scalar. It has a print() method.

Examples

x <- c(1, 30, 44, 20, 0, 10, 15, 5, 2, 50, 35, 25)
y <- c(2, 35, 50, 27, 1, 15, 17, 7, 0, 53, 35, 30)
res <- razao_vs_regressao_decidir(x, y, X_barra = 10, N = 1500)
res$recomendado
print(res)

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