% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/engine.R
\name{mlumr_engine}
\alias{mlumr_engine}
\title{Get or Set the Stan Engine}
\usage{
mlumr_engine(engine = NULL)
}
\arguments{
\item{engine}{Character string: \code{"rstan"} or \code{"cmdstanr"}. If \code{NULL}
(default), returns the current engine without changing it.}
}
\value{
The current engine (character), returned invisibly when setting.
}
\description{
Control which Stan backend mlumr uses for model fitting. The default engine
is \code{"rstan"} (compiled C++ models via rstantools). Users who prefer cmdstanr
can switch engines after installation.
}
\details{
When switching to \code{"cmdstanr"}, this function checks whether the cmdstanr
package and CmdStan toolchain are installed. If either is missing, it offers
to install them interactively.

Engine names must be matched exactly. Partial strings such as \code{"c"} are not
accepted.

The engine preference is stored as \code{options(mlumr.stan_engine = ...)} and
persists for the current R session. To set a permanent default, add to your
\code{.Rprofile}:

\if{html}{\out{<div class="sourceCode">}}\preformatted{options(mlumr.stan_engine = "cmdstanr")
}\if{html}{\out{</div>}}
}
\examples{
# Check current engine
mlumr_engine()

# Switch to cmdstanr (interactive)
\dontrun{
mlumr_engine("cmdstanr")
}
}
