# Save this file as `R/lm_stan.R`
#' Bayesian linear regression with Stan
#'
#' @export
#' @param x Numeric vector of input values.
#' @param y Numberic vector of output values.
#' @param ... Arguments passed to `rstan::sampling` (e.g. iter, chains).
#' @return An object of class `stanfit` returned by `rstan::sampling`
#'
lm_stan <- function(x, y, ...) {
standata <- list(x = x, y = y, N = length(y))
out <- rstan::sampling(stanmodels$lm, data = standata, ...)
return(out)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.