# small R
n=100
x=runif(n,0,1)
y=sample(rep(1:3), n, replace = TRUE, prob = c(1/3,1/3,1/3))
IVCCAT(y,x,K=5,num_per=20,type = "fixed")
# large R
n=200
y=sample(rep(1:20), n, replace = TRUE, prob = rep(1/20,20))
mu_x=sample(c(1,2,3,4),20,replace = TRUE,prob = c(1/4,1/4,1/4,1/4))
x=c()
for (i in 1:n) {
x[i]=2*mu_x[y[i]]+rcauchy(1)
}
IVCCAT(y,x,K=10,type = "infinity")
Run the code above in your browser using DataLab