Learn R Programming

bayess (version 1.4)

ARllog: log-likelihood associated with an AR(p) model defined either through its natural coefficients or through the roots of the associated lag-polynomial

Description

This function is related to Chapter 6 on dynamical models. It returns the numerical value of the log-likelihood associated with a time series and an AR(p) model, along with the natural coefficients $psi$ of the AR(p) model if it is defined via the roots lr and lc of the associated lag-polynomial. The function thus uses either the natural parameterisation of the AR(p) model $$x_t - \mu + \sum_{i=1}^p \psi_i (x_{t-i}-\mu) = \varepsilon_t$$ or the parameterisation via the lag-polynomial roots $$\prod_{i=1}^p (1-\lambda_i B) x_t = \varepsilon_t$$ where $B^j x_t = x_{t-j}$.

Usage

ARllog(p,dat,pr, pc, lr, lc, mu, sig2, compsi = TRUE, pepsi = c(1, rep(0, p)))

Arguments

p
order of the AR$(p)$ model
dat
time series modelled by the AR$(p)$ model
pr
number of real roots
pc
number of non-conjugate complex roots
lr
real roots
lc
complex roots, stored as real part for odd indices and imaginary part for even indices
mu
drift coefficient $\mu$ such that $(x_t-\mu)_t$ is a standard AR$(p)$ series
sig2
variance of the Gaussian white noise $(\varepsilon_t)_t$
compsi
boolean variable indicating whether the coefficients $\psi_i$ need to be retrieved from the roots of the lag-polynomial, i.e. if the model is defined by pepsi (when compsi is FALSE) or by lr and l
pepsi
potential p+1 coefficients $\psi_i$ if compsi is FALSE, with 1 as the compulsory first value

Value

  • llvalue of the log-likelihood
  • psvector of the $\psi_i$'s

See Also

MAllog,ARmh

Examples

Run this code
ARllog(p=3,dat=faithful[,1],pr=3,pc=0,
lr=c(-.1,.5,.2),lc=0,mu=0,sig2=var(faithful[,1]),compsi=FALSE,pepsi=c(1,rep(.1,3)))

Run the code above in your browser using DataLab