# \donttest{
library(parallel)
library(boot)
library(car)
library(mvtnorm)
set.seed(1234)
n <- 100
sigma<-matrix(c(1,0,0,0.9, 0,1,-0.8,0, 0,-0.8,1,0, 0.9,0,0,1), nr=4, nc=4)
############################
# Gaussian correlated inputs
X <- as.data.frame(rmvnorm(n, rep(0,4), sigma))
colnames(X) <- c("X1","X2","X3","X4")
#############################
# Linear Model with small noise, two correlated inputs (X2 and X3) and
# one dummy input (X4) correlated with another (X1)
epsilon <- rnorm(n,0,0.1)
y <- with(X, X1 - X2 + 0.5 * X3 + epsilon)
# Without Bootstrap confidence intervals
x <- VIM(X, y)
print(x)
plot(x)
library(ggplot2) ; ggplot(x)
# With Boostrap confidence intervals
x <- VIM(X, y, nboot=100, conf=0.9)
print(x)
plot(x)
library(ggplot2) ; ggplot(x)
############################
# Logistic Regression (same regression model)
epsilon <- rnorm(n,0,0.1)
y <- with(X, X1 - X2 + 0.5 * X3 + epsilon > 0)
x <- VIM(X, y, logistic = TRUE)
print(x)
plot(x)
library(ggplot2) ; ggplot(x)
# }
Run the code above in your browser using DataLab