View source: R/main-declarations.R
stan_transform | R Documentation |
Create a StanTransformation object
stan_transform(decl, origin = "model", code = "")
decl |
The Stan variable declaration for the quantity. Must be an object that inherits from StanDeclaration. |
origin |
Must be either |
code |
A string of Stan code that defines how the quantity is
computed from other variables/parameters.
The default is empty string (no definition). If |
Other Stan variable declaration functions:
stan_array()
,
stan_dim()
,
stan_matrix()
,
stan_param()
,
stan_var()
,
stan_vector()
,
stan_vector_array()
N <- stan_dim("N")
D <- stan_dim("D")
decl <- stan_array("y", dims = list(N, D), type = "int")
code <- "
for(n in 1:N) {
for(d in 1:D) {
y[n, d] ~ poisson_rng(0.2);
}
}"
y <- stan_transform(decl, code = code)
print(y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.