Description Usage Arguments Details Value Examples
Creates set of restricted models to be used for posterior density estimation
1 | create.restricted.models(ikde.model, eval.point)
|
ikde.model |
An object of class ikde.model, does not necessarily have to be built |
eval.point |
A list of parameter names and the point to evaluate densities |
Posterior density can be estimated by breaking the multi-dimensional density into one-dimensional components. This method creates restricted models from which conditional densities can be estimated. Each real parameter and each entry of vector parameters are restricted one at a time, with values restricted at the specified point.
Returns a list of built ikde.models for each restricted model
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | data(lm.generated)
X <- lm.generated$X
y <- lm.generated$y
data <- list(N = list(type = "int<lower=1>", dim = 1, value = nrow(X)),
k = list(type = "int<lower=1>", dim = 1, value = ncol(X)),
X = list(type = "matrix", dim = "[N, k]", value = X),
y = list(type = "vector", dim = "[N]", value = y))
parameters <- list(beta = list(type = "vector", dim = "[k]"),
sigma_sq = list(type = "real<lower=0>", dim = 1))
model <- list(priors = c("beta ~ normal(0, 10);",
"sigma_sq ~ inv_gamma(1, 1);"),
likelihood = c("y ~ normal(X * beta, sqrt(sigma_sq));"))
ikde.model <- define.model(data, parameters, model)
eval.point <- list(beta = c(1, 2, 3, 4),
sigma = 5)
ikde.model.list <- create.restricted.models(ikde.model, eval.point)
for (restricted.ikde.model in ikde.model.list){
cat(restricted.ikde.model$stan.code)
cat("--------------------------------------------------\n")
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.