library(parallel)
library(gtools)
library(boot)
library(mvtnorm)
set.seed(1234)
n <- 100
beta<-c(1,-2,3)
sigma<-matrix(c(1,0,0,
0,1,-0.8,
0,-0.8,1),
nrow=3,
ncol=3)
############################
# Gaussian correlated inputs
X <-rmvnorm(n, rep(0,3), sigma)
#############################
# Linear Model
y <- X%*%beta + rnorm(n)
# Without Bootstrap confidence intervals
x<-pmvd(X, y)
print(x)
plot(x)
# With Boostrap confidence intervals
x<-pmvd(X, y, nboot=100, conf=0.95)
print(x)
plot(x)
# Rank-based analysis
x<-pmvd(X, y, rank=TRUE, nboot=100, conf=0.95)
print(x)
plot(x)
############################
# Logistic Regression
y<-as.numeric(X%*%beta + rnorm(n)>0)
x<-pmvd(X,y, logistic = TRUE)
plot(x)
print(x)
# Parallel computing
#x<-pmvd(X,y, logistic = TRUE, parl=2)
#plot(x)
#print(x)
Run the code above in your browser using DataLab