# NOT RUN {
n <- 20
p <- 2
library(randtoolbox)
X <- sobol(n, dim = p, init = TRUE, scrambling = 2, seed = 20, normal = FALSE)
y <- exp(2*sin(0.5*pi*X[,1]) + 0.5*cos(2.5*pi*X[,2]))
ini.TAG <- initial.TAG(y, X)
#An example for some inputs with fewer levels
n <- 18
p <- 2
X1 <- rep(c(0,1,2)/3, 6) # A factor with fewer levels
library(randtoolbox)
X2 <- sobol(n, dim = 1, init = TRUE, scrambling = 2, seed = 20, normal = FALSE)
X <- cbind(X1, X2)
y <- exp(2*sin(0.5*pi*X[,1]) + 0.5*cos(2.5*pi*X[,2]))
ini.TAG <- initial.TAG(y, X)
# }
Run the code above in your browser using DataLab