% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ADVI.R
\name{ADVI_method}
\alias{ADVI_method}
\title{Automatic Differentiation Variational Inference (ADVI)}
\usage{
ADVI_method(
  model,
  par_list,
  pl_full,
  iter = 3000,
  tol_rel_obj = 0.001,
  window_size = 100,
  num_samples = 1000,
  alpha = 0.01,
  laplace = FALSE,
  print_freq = 500,
  method = c("meanfield", "fullrank", "hybrid"),
  update_progress = NULL,
  update_interval = 100
)
}
\arguments{
\item{model}{An RTMB objective function object (`ad_obj`).}

\item{par_list}{A list defining the structure of parameters to be estimated.}

\item{pl_full}{A list defining the full structure of parameters including random effects.}

\item{iter}{Integer; fixed number of iterations for the optimization. Default is 3000.}

\item{tol_rel_obj}{Numeric; relative tolerance for the ELBO to check convergence. Default is 0.001.}

\item{window_size}{Integer; size of the moving window to calculate the median ELBO. Default is 100.}

\item{num_samples}{Integer; number of posterior draws to generate after optimization. Default is 1000.}

\item{alpha}{Numeric; learning rate (step size) for the Adam optimizer. Default is 0.01.}

\item{laplace}{Logical; whether Laplace approximation is used. Default is FALSE.}

\item{print_freq}{Integer; frequency of printing progress to the console. Set to 0 to disable. Default is 500.}

\item{method}{Character; type of variational distribution. One of "meanfield", "fullrank", or "hybrid". Default is "meanfield".}

\item{update_progress}{Optional function to update a progress bar.}

\item{update_interval}{Integer; interval for updating the progress bar. Default is 100.}
}
\value{
A list containing `fit`, `random_fit`, `elbo_history`, `elbo_final`, `rel_obj_final`, and `converged`.
}
\description{
Automatic Differentiation Variational Inference (ADVI)
}
