dot-razao_resumo: Compute summary statistics needed by the ratio estimator

.razao_resumoR Documentation

Compute summary statistics needed by the ratio estimator

Description

Internal helper that accepts either raw vectors x/y or pre-aggregated sums, and returns a common set of summary statistics (n, sum_x, sum_y, sum_x2, sum_y2, sum_xy, r) used by the ⁠razao_*()⁠ functions. Supporting both calling styles matters because some textbook problems (e.g. Example 7.5 of the course notes) give only pre-computed sums, not the raw sample data.

Usage

.razao_resumo(
  x = NULL,
  y = NULL,
  n = NULL,
  sum_x = NULL,
  sum_y = NULL,
  sum_x2 = NULL,
  sum_y2 = NULL,
  sum_xy = NULL
)

Arguments

x, y

Optional raw numeric vectors.

n, sum_x, sum_y, sum_x2, sum_y2, sum_xy

Optional pre-aggregated summary statistics (used only if x/y are not supplied).

Value

A list with n, sum_x, sum_y, sum_x2, sum_y2, sum_xy, r, and soma_dyx2 (= sum((y - r*x)^2), via the computational Eq. 7.40).


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