% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/composite.R
\name{htdv_composite}
\alias{htdv_composite}
\title{Composite Log-Likelihood for Dependent Data}
\usage{
htdv_composite(x, density_fun, theta, k = 1L, log = FALSE)
}
\arguments{
\item{x}{Numeric vector.}

\item{density_fun}{Function \code{function(block, theta)} returning the
joint density of a \code{(k+1)}-block of consecutive observations.}

\item{theta}{Numeric parameter vector.}

\item{k}{Window width (pairwise if \code{k = 1}).}

\item{log}{Logical; if \code{TRUE}, \code{density_fun} already returns log
densities.}
}
\value{
A list with \code{loglik} (scalar), \code{n_blocks}, and
  \code{block_values}.
}
\description{
Pairwise or \code{k}-tuple composite log-likelihood (Varin, Reid and Firth
2011) for strictly stationary sequences.
}
\examples{
x <- arima.sim(model = list(ar = 0.4), n = 200, rand.gen = rnorm)
gauss_ar1 <- function(block, theta) {
  phi <- theta[1]; sigma2 <- theta[2]
  a <- block[1]; b <- block[2]
  dnorm(a, 0, sqrt(sigma2 / (1 - phi^2)), log = TRUE) +
    dnorm(b, phi * a, sqrt(sigma2), log = TRUE)
}
htdv_composite(as.numeric(x), gauss_ar1, c(0.4, 1), k = 1, log = TRUE)$loglik

}
\references{
Varin, C., Reid, N., & Firth, D. (2011). An overview of composite
likelihood methods. Statistica Sinica, 21(1), 5-42.
}
