## Not run:
#
# ##################################
# # Test case : the Ishigami function (3 uniform independent inputs)
# # See Iooss and Prieur (2017)
#
# library(gtools)
#
# d <- 3
# Xall <- function(n) matrix(runif(d*n,-pi,pi),nc=d)
# Xset <- function(n, Sj, Sjc, xjc) matrix(runif(n*length(Sj),-pi,pi),nc=length(Sj))
#
# x <- shapleyPermEx(model = ishigami.fun, Xall=Xall, Xset=Xset, d=d, Nv=1e4, No = 1e3, Ni = 3)
# print(x)
# plot(x)
#
# ##################################
# # Test case : Linear model (3 Gaussian inputs including 2 dependent)
# # See Iooss and Prieur (2017)
#
# library(gtools)
# library(mvtnorm) # Multivariate Gaussian variables
# library(condMVNorm) # Conditional multivariate Gaussian variables
#
# modlin <- function(X) apply(X,1,sum)
#
# d <- 3
# mu <- rep(0,d)
# sig <- c(1,1,2)
# ro <- 0.9
# Cormat <- matrix(c(1,0,0,0,1,ro,0,ro,1),d,d)
# Covmat <- ( sig %*% t(sig) ) * Cormat
#
# Xall <- function(n) mvtnorm::rmvnorm(n,mu,Covmat)
#
# Xset <- function(n, Sj, Sjc, xjc){
# if (is.null(Sjc)){
# if (length(Sj) == 1){ rnorm(n,mu[Sj],sqrt(Covmat[Sj,Sj]))
# } else{ mvtnorm::rmvnorm(n,mu[Sj],Covmat[Sj,Sj])}
# } else{ condMVNorm::rcmvnorm(n, mu, Covmat, dependent.ind=Sj, given.ind=Sjc, X.given=xjc)}}
#
# x <- shapleyPermEx(model = modlin, Xall=Xall, Xset=Xset, d=d, Nv=1e4, No = 1e3, Ni = 3)
# print(x)
# plot(x)
# ## End(Not run)
Run the code above in your browser using DataLab