easystats / easystats/performance

When predictors are uncorrelated -- the 95% CI for the VIF includes infinity and the graph in the performance plots is strange.

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

Nobody has claimed this yet.

3 investigators :grey_question::question:
Dominant language
R
Stars
1.2k
Forks
109
Avg merge
6h 34m
Merged PRs (30d)
8

Description

set.seed(123)

# Number of observations
n <- 100

# Generate two uncorrelated predictors
x1 <- rnorm(n)
x2 <- rnorm(n)

# Generate noise
noise <- rnorm(n)

# Generate outcome as a linear combination of the predictors and noise
y <- 0.5*x1 + 0.5*x2 + noise

# Create a data frame
data <- data.frame(y = y, x1 = x1, x2 = x2)

# View the first few rows of the data frame
head(data)
#>            y          x1          x2
#> 1  1.5633692 -0.56047565 -0.71040656
#> 2  1.3257661 -0.23017749  0.25688371
#> 3  0.3908632  1.55870831 -0.24669188
#> 4  0.4046770  0.07050839 -0.34754260
#> 5 -0.8255054  0.12928774 -0.95161857
#> 6  0.3587717  1.71506499 -0.04502772

mod <- lm(data = data, y ~ x1 + x2)
mod |> performance::check_model()

mod |> performance::check_collinearity()
#> # Check for Multicollinearity
#> 
#> Low Correlation
#> 
#>  Term  VIF  VIF 95% CI Increased SE Tolerance Tolerance 95% CI
#>    x1 1.00 [1.00, Inf]         1.00      1.00     [0.00, 1.00]
#>    x2 1.00 [1.00, Inf]         1.00      1.00     [0.00, 1.00]

Created on 2023-07-04 with reprex v2.0.2

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

Reproduce the example with lm(data = data, y ~ x1 + x2), then inspect performance::check_collinearity() and performance::check_model(), including the performance-plot graph. Compare the reported VIF confidence intervals and graph against the uncorrelated predictors; done means the infinity interval and strange graph behavior are handled consistently.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.