% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ngme.R
\name{ngme}
\alias{ngme}
\title{Fit an additive linear mixed effect model over replicates}
\usage{
ngme(
  formula,
  data,
  family = "normal",
  control_opt = NULL,
  control_ngme = NULL,
  group = NULL,
  replicate = NULL,
  start = NULL,
  moving_window = 1,
  prior_beta = NULL,
  debug = FALSE
)
}
\arguments{
\item{formula}{formula}

\item{data}{a dataframe or a list providing data
(Only response variable can contain \code{NA} value,
 \code{NA} value in other columns will cause problem)}

\item{family}{likelihood type, same as measurement noise specification. It can be provided as:
\enumerate{
  \item a string, e.g., \code{"normal"}, \code{"nig"}, \code{"t"}.
  \item an ngme noise object, e.g., \code{noise_normal()}, \code{noise_nig(mu = 0, sigma = 1, nu = 1)}, \code{noise_t(nu=5)}.
}}

\item{control_opt}{control for optimizer. by default it is \code{control_opt()}. See \code{?control_opt} for details.}

\item{control_ngme}{control for ngme model. by default it is \code{control_ngme()}. See \code{?control_ngme} for details.}

\item{group}{factor, used for bivariate model, indicating which group the observation belongs to}

\item{replicate}{factor, used for divide data into different replicates}

\item{start}{starting ngme object (usually object from last fit)}

\item{moving_window}{number of iterations to average the estimation}

\item{prior_beta}{prior specification for fixed effects (`beta`), created by
\code{prior_*()} or \code{priors(...)}.}

\item{debug}{toggle debug mode}
}
\value{
random effects (for different replicate) + models(fixed effects, measuremnt noise, and latent process)
}
\description{
\code{ngme} function performs an analysis of non-gaussian additive models.
 It does the maximum likelihood estimation via stochastic gradient descent.
 The prediction of unknown location can be performed by leaving the response
 variable to be \code{NA}. The likelihood is specified by \code{family}.
The model estimation control can be setted in \code{control} using
 \code{control_opt()} function, see \code{?control_opt} for details.
See \code{ngme_model_types()} for available models.
}
\examples{
ngme(
  formula = Y ~ x1 + f(
    x2,
    model = ar1(rho = 0.5),
    noise = noise_nig()
  ) + f(x1,
    model = rw1(),
    noise = noise_normal(),
  ),
  family = noise_normal(sd = 0.5),
  data = data.frame(Y = 1:5, x1 = 2:6, x2 = 3:7),
  control_opt = control_opt(
    estimation = FALSE
  )
)
}
