Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
klh281 opened this issue Jul 4, 2023 · 0 comments
Labels
3 investigators ❔❓ Need to look further into this issue

Comments

@klh281
Copy link

klh281 commented Jul 4, 2023

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

@strengejacke strengejacke added the 3 investigators ❔❓ Need to look further into this issue label Jul 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue
Projects
None yet
Development

No branches or pull requests

2 participants