Description Usage Arguments Details Value Examples
Defines Stan model and stores input data
1 2 | define.model(data, parameters, model, transformed.data = list(),
transformed.parameters = list())
|
data |
A list of data passed to the Stan program. Should be of the form list(data.name = list(type = string, dim = number/string (e.g., "[N]"), value = data.object)). |
parameters |
A list of parameters used in the Stan program. Should be of the form list(parameter.name = list(type = string, dim = number/string)). |
model |
A list describing the Stan model. Should be a list with components "priors" and "likelihood". |
transformed.data |
A list describing data transformations for the Stan program to perform. Should be of the form list(variable.name = list(type = string, dim = number/string, expression = string)). |
transformed.parameters |
A list describing parameter transformations for the Stan program to perform. Should be of the form list(variable.name = list(type = string, dim = number/string, expression = string)). |
Defines inputs to be used for building and eventually fitting Stan model.
Returns an ikde.model object with the following elements
data |
A list of data passed to the Stan program |
transformed.data |
A list describing data transformations for the Stan program to perform |
parameters |
A list of parameters used in the Stan program |
transformed.parameters |
A list describing parameter transformations for the Stan program to perform |
model |
A list describing the Stan model |
stan.code |
Stan code for the model |
stan.data |
Data passed to Stan for estimation |
stan.dso |
DSO for Stan model, allows Stan to run model without recompilation |
built |
Boolean indicating whether the model has been built |
density.variable |
List containing two elements: "name" of the variable on which density estimation should be performed on, and "value" indicating the point at which density should be estimated |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.