weasel is an R package for researchers working with longitudinal panel or
repeated-measures data who need to decide which waves and respondents belong
in an analysis sample. It maps participation patterns, compares explicit
selection scenarios using missing-wave tolerances, endpoint requirements,
and interior-gap constraints, and audits the resulting sample with
sensitivity and selectivity diagnostics.
Which workflow do you need? Answer one question at a time to reach the right recipe. The address bar follows along, so any step or recipe can be shared as a direct link.
NA placeholder rows for missed waves."consecutive" counts every integer in the window; "observed" counts only distinct wave values recorded in the data. Year labels alone do not determine the correct choice."consecutive" with explicit bounds. Inspect the printed span in each recipe before selection.The figures below use the notation of weasel's own pattern tables: a number is an observed wave (a row exists in the long data), a dot is a missed wave (the row is simply absent).
Wave-level missingness is row absence: waves 4 and 7 are not NA
rows, they simply do not exist in the data. NA values inside
observed rows are item nonresponse and never affect selection.
grid = "consecutive"grid = "observed" (biennial)
The span is the analysis window, lower:upper. The grid decides
which waves inside it count as scheduled: every integer
("consecutive") or only wave values that occur in the data
("observed"), so 2011 is never a missed wave in a biennial panel.
An interior gap is a run of missing waves strictly between a respondent's first and last observed wave. The top row misses both endpoints (▾) yet contains no gap; the bottom row keeps both endpoints and has exactly one gap of length 2.
require_endpoints max_missing = 1
n_gap_max = 1 max_gap_len = 1
The built-in anchored_balanced scenario applied to four
respondents observed in the span (the planning population). Retention is
always reported against that denominator, here 2 of 4.
grid = "observed" uses only waves that occur in the data. Use it when those recorded values represent the intended schedule; an entirely absent scheduled wave cannot be inferred... 3 4 5 .. misses both endpoints yet has no interior gap.1 2 .. 5 6 7 has one gap of length 2; 1 . 3 . 5 . 7 has three gaps of length 1; late entry and early exit are not gaps.min_present, max_missing, n_gap_max, max_gap_len, and require_endpoints. min_present is Scope-only. Plan scenario tables use exactly five fields: scenario (the name), require_endpoints, max_missing, n_gap_max, and max_gap_len. On a fixed grid of length L, at least M observed waves (integer M, 1 ≤ M ≤ L) is equivalent to max_missing = L - M, with other constraints held equal. L counts grid waves, for example length(p$span), and need not equal upper - lower + 1 on an observed grid.weasel_selectivity() helps you check, it does not decide.