Package 'wavecov'

Title: Overlap-Aware Workforce Wave Comparisons
Description: Tools for comparing workforce metric distributions between panel waves using linked stayers, reliability assumptions, or Cauchy bounds. Its purpose is to provide a low-latency alternative to traditional hierarchical or latent-growth modeling that is better-able to scale in cloud based architectures. The mathematics is an extension of rotating panel formulae from the official statistics literature.
Authors: Jack Kostal [aut, cre]
Maintainer: Jack Kostal <[email protected]>
License: GPL-3
Version: 0.1.0
Built: 2026-11-03 23:53:09 UTC
Source: https://github.com/cran/wavecov

Help Index


Compare two workforce waves for a single metric

Description

Compute overlap-aware inference for the change in a repeated organizational metric between two workforce waves, using linked stayers, a reliability assumption, or Cauchy-based bounds.

Usage

compare_waves(
  data,
  wave_0,
  wave_1,
  id_col,
  wave_col,
  metric_col,
  method = c("auto", "linked", "reliability", "bounds"),
  reliability = NULL,
  sigma2 = NULL,
  sigma2S = NULL,
  cov_sign = c("unrestricted", "nonnegative"),
  overlap_mode = c("generic", "overlap_aware"),
  level = 0.95,
  ...
)

Arguments

data

Data frame with at least id, wave, and metric columns.

wave_0

Value in wave_col for the first wave.

wave_1

Value in wave_col for the second wave.

id_col

Column name for the employee identifier.

wave_col

Column name for the wave identifier.

metric_col

Column name for the metric.

method

Method to use: "auto", "linked", "reliability", or "bounds". In "auto" mode, wavecov prefers linked, then reliability, then bounds.

reliability

Same-person cross-wave reliability for the relevant stayer population (used only for the reliability method).

sigma2

Optional common individual-level variance. When supplied with the reliability method, overrides the pooled variance from the two waves.

sigma2S

Optional pooled individual-level stayer variance. When supplied with the reliability method, is treated as a candidate sigma2. When supplied with the bounds method and overlap_mode = "overlap_aware", is used as a common stayer variance to tighten the Cauchy bounds.

cov_sign

Covariance sign restriction for bounds: "unrestricted" or "nonnegative".

overlap_mode

Whether to use generic Cauchy bounds ("generic") or overlap-aware tightening ("overlap_aware").

level

Confidence level for intervals (point-estimate methods) or sensitivity envelopes (bounded results).

...

Reserved for future extensions.

Value

A "wavecov_result" object (linked or reliability) or a "wavecov_bounds_result" object (bounds). Use print(), tidy(), and confint() for summaries.


Batch comparisons of multiple waves and metrics

Description

Batch comparisons of multiple waves and metrics

Usage

compare_waves_batch(
  data,
  wave_pairs,
  id_col,
  wave_col,
  metric_col,
  metric_id_col = NULL,
  group_cols = NULL,
  method = c("linked", "reliability", "bounds", "auto", "ols"),
  reliability = NULL,
  sigma2 = NULL,
  sigma2S = NULL,
  level = 0.95,
  ...
)

Arguments

data

...

wave_pairs

...

id_col

...

wave_col

...

metric_col

...

metric_id_col

...

group_cols

...

method

...

reliability

...

sigma2

...

sigma2S

...

level

...

...

...

Value

...


Compare two waves using summary statistics only

Description

When individual-level data are not available, this function computes overlap-aware variance for the change in means using either a reliability assumption or Cauchy-based bounds from supplied summary statistics.

Usage

compare_waves_summary_stats(
  N0,
  N1,
  nS,
  sigma2 = NULL,
  reliability = NULL,
  V0_bar = NULL,
  V1_bar = NULL,
  method = c("reliability", "bounds"),
  cov_sign = c("unrestricted", "nonnegative"),
  overlap_mode = c("generic", "overlap_aware"),
  sigma2S = NULL,
  level = 0.95
)

Arguments

N0

Workforce size at wave 0.

N1

Workforce size at wave 1.

nS

Number of stayers (present in both waves).

sigma2

Common individual-level variance for the relevant population (used with the reliability method).

reliability

Same-person cross-wave reliability (used with the reliability method).

V0_bar

Variance of the wave-0 mean (used with the bounds method).

V1_bar

Variance of the wave-1 mean (used with the bounds method).

method

"reliability" or "bounds".

cov_sign

Covariance sign restriction for bounds: "unrestricted" or "nonnegative".

overlap_mode

Whether to use generic Cauchy bounds or overlap-aware tightening. Overlap-aware bounds additionally use nS and sigma2S when supplied.

sigma2S

Optional pooled individual-level stayer variance for overlap-aware bounds.

level

Confidence level for point-estimate intervals or sensitivity envelopes.

Value

A "wavecov_result" (reliability) or "wavecov_bounds_result" (bounds) object. Use print(), tidy(), and confint() for summaries.


Generic tidy method

Description

A minimal generic for tidying objects returned by wavecov functions.

Usage

tidy(x, ...)

Arguments

x

An object to tidy.

...

Unused.

Value

A data frame with a structure determined by the class of x.


Tidy output for wavecov point-estimate results

Description

Tidy output for wavecov point-estimate results

Usage

## S3 method for class 'wavecov_result'
tidy(x, ...)

Arguments

x

A "wavecov_result" object.

...

Unused.

Value

A one-row data frame with change estimates and diagnostics.