tidymodels / tidymodels/multilevelmod

Tighten checks in `id_var()` column for GEE

Open
#90 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature
Dominant language
R
Stars
74
Forks
6
Avg merge
1h 53m
Merged PRs (30d)
1

Description

library(multilevelmod)
#> Loading required package: parsnip

df <- data.frame(
  y = rnorm(20),
  x = rnorm(20),
  group1 = rep(1:4, each = 5),
  group2 = rep(1:5, times = 4)
)

# we require a single id column
fit <- gee_fit(y ~ x + id_var(group1) + id_var(group2), data = df)
#> Error in `gee_formula()`:
#> ! There should be a single id column specified using the `id_vars()`
#>   function.
#> ℹ For example: `y ~ x + id_vars(id_col)`

# but this slips through the checks
fit <- gee_fit(y ~ x + id_var(group1 + group2), data = df)
#> Error in .subset2(x, i, exact = exact): subscript out of bounds

Created on 2026-01-13 with reprex v2.1.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the gee_fit() call into gee_formula() and the validation of id_var() expressions. Reproduce both formulas from the issue, then make sure a combined expression such as id_var(group1 + group2) is rejected with the intended single-id-column error instead of a subscript failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.