# NOT RUN {
set.seed(1001)
## define true parameters
G <- 10
mug <- seq(from= -2.0, to= 2.0, length=G)
sigmag <- seq(from= 2.0, to= 0.8, length=G)
cutpoints <- c(-1.0, 0.0, 0.8)
## generate data with large counts
ng <- rep(100000,G)
ngk <- gendata_hetop(G, K = 4, ng, mug, sigmag, cutpoints)
print(ngk)
## compare theoretical and empirical cell probabilities
phat <- ngk / ng
ptrue <- t(sapply(1:G, function(g){
tmp <- c(pnorm(cutpoints, mug[g], sigmag[g]), 1)
c(tmp[1], diff(tmp))
}))
print(max(abs(phat - ptrue)))
# }
Run the code above in your browser using DataLab