% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_stancode.R
\name{make_stancode}
\alias{make_stancode}
\title{Stan Code for PStrata Models}
\usage{
make_stancode(object, filename = NULL, debug = FALSE)
}
\arguments{
\item{object}{An internal model specification object.}

\item{filename}{(optional) string. If not \code{NULL}, the
Stan file is saved to this path.}

\item{debug}{only for development/testing use.}
}
\value{
A string containing the Stan program.
}
\description{
Generate the Stan code corresponding to the model.
This is called internally by \code{\link{fit}}; use
\code{\link{stancode.PStrataFit}} to retrieve the code
from a fitted model.
}
\examples{
\donttest{
data(sim_data_normal)
model <- PStrataModel(
  S.formula = Z + D ~ 1,
  Y.formula = Y ~ 1,
  Y.family  = gaussian(),
  strata    = c(n = "00", c = "01", a = "11"),
  ER        = c("n", "a")
)
ps_fit <- fit(model, data = sim_data_normal, chains = 2, iter = 500)
cat(ps_fit$stancode)
}

}
