### Example 1
library(multiColl)
set.seed(2025)
obs = 100
cte = rep(1, obs)
x2 = rnorm(obs, 5, 0.01)
x3 = rnorm(obs, 5, 10)
x4 = x3 + rnorm(obs, 5, 1)
x5 = rnorm(obs, -1, 30)
x = cbind(cte, x2, x3, x4, x5)
rvifs(x)
### Example 2
### The special case of the simple linear regression model
head(SLM1, n=5)
x = SLM1[,2:3]
rvifs(x)
### Example 3
### The intercept must be in the first column of the design matrix
set.seed(2025)
obs = 100
cte = rep(1, obs)
x2 = sample(1:500, obs)
x3 = sample(1:500, obs)
x4 = rep(4, obs)
x = cbind(cte, x2, x3, x4)
rvifs(x) # also: perfect multicollinearity between the intercept and the constant variable
rvifs(x[,-1], intercept = FALSE) # removing the constant from the design matrix
### Example 4
### Cases of perfect multicollinearity or computationally singular systems
head(soil, n=5)
x = soil[,-16]
rvifs(x)
Run the code above in your browser using DataLab