In a manner of speaking, defining an arbitrary posterior distribution is all you can do in the Stan language. But if you are referring specifically to a posterior distribution that is not a composition of distributions that are already defined in Stan, then you can use the increment_log_prob function to...

In the case of bayesglm, you could do sims <- arm::sim(m1.arm, n = 1000) y_sim <- rnorm(n = 1000, mean = [email protected] %*% t(as.matrix(s1)), sd = [email protected]) mean(y_sim) For the (unreleased) rstanarm, it would be similar sims <- as.matrix(m1.stan) y_sim <- rnorm(n = nrow(sims), mean = sims[,1:(ncol(sims)-1)] %*% t(as.matrix(s1)), sd...

You can run the models separately, and then combine them using sflist2stanfit(). E.g. seed <- 12345 s1 <- stan_model(model_code = code) # compile the model m1 <- sampling(object = s1, data = df1, chains = 1, seed = seed, chain_id = 1, iter = 1000) m2 <- sampling(object = s1,...

For completeness, I answered John's question when he posted it on the Stan-users mailing list. In short, it does not matter how many cores are used at build time, you can use any number of cores at run time using any parallel scheme supported by R (or any of the...

You want to look at help(optimizing, package = "rstan"), i.e. the optimizing() function in the RStan package.

Constrained local parameters, such as simplexes, cannot be declared inside the model block because they are not checked. So, you should just declare pi to be a plain vector of length 7, like vector[7] pi;. Nevertheless, pi needs to be on the simplex in order to be an admissible argument...