#' Create stanreg object
#' @param number sample size
#' @export
test <- function(number) {
stanmodelcode <- "
data {
int<lower=0> N;
real y[N];
}
parameters {
real mu;
}
model {
target += normal_lpdf(mu | 0, 10);
target += normal_lpdf(y | mu, 1);
}
"
y <- stats::rnorm(20)
dat <- list(N = number, y = y);
fit <- rstan::stan(model_code = stanmodelcode, model_name = "example",
data = dat, iter = 2012, chains = 3, verbose = TRUE,
sample_file = file.path(tempdir(), 'norm.csv'))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.