% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/score_vector_barma.R
\name{score_vector_barma}
\alias{score_vector_barma}
\title{Score Vector for the BARMA Model}
\usage{
score_vector_barma(
  y,
  ar = integer(0),
  ma = integer(0),
  alpha,
  varphi = numeric(0),
  theta = numeric(0),
  phi,
  link = "logit",
  xreg = NULL,
  beta = NULL,
  penalty = FALSE
)
}
\arguments{
\item{y}{A numeric vector representing the time series data, with values
strictly in (0, 1).}

\item{ar}{A numeric vector specifying the autoregressive (AR) lags
(e.g., \code{c(1, 2)}). Defaults to \code{integer(0)}, which omits the
AR component entirely. Absence should be expressed by omitting this
argument or passing \code{integer(0)}.}

\item{ma}{A numeric vector specifying the moving average (MA) lags
(e.g., \code{1}). Defaults to \code{integer(0)}, which omits the
MA component entirely. Absence should be expressed by omitting this
argument or passing \code{integer(0)}.}

\item{alpha}{The intercept term (numeric scalar).}

\item{varphi}{A numeric vector of autoregressive (AR) parameters.
Absence should be expressed by omitting this argument or passing
\code{numeric(0)}.}

\item{theta}{A numeric vector of moving average (MA) parameters.
Absence should be expressed by omitting this argument or passing
\code{numeric(0)}.}

\item{phi}{The precision parameter of the BARMA model (must be positive and finite).
Larger values indicate less variance for a given mean.}

\item{link}{A character string specifying the link function:
\code{"logit"} (default), \code{"probit"}, or \code{"cloglog"}.}

\item{xreg}{A matrix or data frame of static regressors (optional).
Must have the same number of rows as length of \code{y}.}

\item{beta}{A numeric vector of regression coefficients for \code{xreg} (optional).
Length must match number of columns in \code{xreg}.}

\item{penalty}{Logical. If \code{TRUE}, the gradient of the ridge penalty of
Cribari-Neto, Costa and Fonseca (2025) is subtracted from the score
vector, yielding the penalized score
\eqn{S_{\text{pen}}(\boldsymbol{\nu}) = S(\boldsymbol{\nu}) -
2(n-a)\lambda_n \boldsymbol{\nu}}, where \eqn{\lambda_n =
1/(n-a)^{0.9}} and \eqn{\boldsymbol{\nu}} collects \eqn{\alpha},
\eqn{\boldsymbol{\varphi}}, and \eqn{\boldsymbol{\theta}}
(\eqn{\phi} and \eqn{\boldsymbol{\beta}} are excluded).
Defaults to \code{FALSE}.}
}
\value{
A numeric vector of the same length as the parameter vector,
  giving the partial derivatives of the log-likelihood with respect
  to each parameter. The order of the components is:
  \code{(alpha, varphi, theta, beta, phi)}.
}
\description{
Computes the score vector (gradient of the log-likelihood)
  for the Beta Autoregressive Moving Average (BARMA) model at a given
  parameter vector. This function is designed for users who:
\itemize{
  \item Implement custom optimization algorithms
  \item Verify theoretical properties
  \item Conduct simulation studies
  \item Debug model fitting
  \item Integrate BARMA models into their own workflows
}
}
\examples{
\donttest{
  # Example 1: Score vector for a BAR(1) model (no MA component)
  set.seed(2025)
  y_sim_bar1 <- simu_barma(
    n      = 250,
    alpha  = 0.0,
    varphi = 0.6,
    phi    = 25.0,
    link   = "logit",
    freq   = 12
  )

  score_vector_barma(
    y      = y_sim_bar1,
    ar     = 1,
    alpha  = 0.0,
    varphi = 0.6,
    theta  = numeric(0),
    phi    = 25.0,
    link   = "logit"
  )

  # Example 2: Score vector for a BARMA(1, 1) model
  set.seed(2025)
  y_sim_barma11 <- simu_barma(
    n      = 250,
    alpha  = 0.0,
    varphi = 0.6,
    theta  = 0.3,
    phi    = 25.0,
    link   = "logit",
    freq   = 12
  )

  score_vector_barma(
    y      = y_sim_barma11,
    ar     = 1,
    ma     = 1,
    alpha  = 0.0,
    varphi = 0.6,
    theta  = 0.3,
    phi    = 25.0,
    link   = "logit"
  )

  # Example 3: Score vector for a BMA(1) model (no AR component)
  set.seed(2025)
  y_sim_bma1 <- simu_barma(
    n      = 250,
    alpha  = 0.0,
    theta  = 0.3,
    phi    = 20.0,
    link   = "logit",
    freq   = 12
  )

  score_vector_barma(
    y      = y_sim_bma1,
    ma     = 1,
    alpha  = 0.0,
    varphi = numeric(0),
    theta  = 0.3,
    phi    = 20.0,
    link   = "logit"
  )
}

}
\seealso{
\code{\link{barma}}, \code{\link{loglik_barma}},
  \code{\link{fim_barma}}
}
