Meanwhile I found the inla.rmarginal() function which almost does what I want for my question #3. It returns continuous values while I expect integers, like rpois() and rbinom() , since I use a negative binomial family. Would it be ok to round the output of inla.rmarginal()? Round it to the nearest integer or round it downwards?
## try the sample facility to get the posterior predictive distribution
samples <- inla.posterior.sample(99,result0)pred <- function(l)
{
#mu <- l$latent["Intercept.1",1] + l$latent["x.1",1] * x
eta <- l$latent[1:500,1] ## extract the linear predictor in log scale
z <- rbinom(500,size=1,1-l$hyperpar[1]) ## extract the zero inflation probability
lambda <- exp(eta) ## apply the link function
y <- rpois(500,lambda=lambda) ## posterior sample of non-zero inflated data
#print(p)
z *y ## apply zero inflation
}ypred <- sapply(samples,pred) ## generate posterior predictive distribution
m0 <- apply(ypred,1,median)
xyplot(m0~y|ifelse(y>0,"non-zero","zero"),xlab="data",ylab="predited")