Next: nlreg() Up: Arima Macros Help File Previous: moveoutroots()   Contents

neg2logLarma()

Usage:
neg2logLarma(y,coefficients, [,x:x] [,pdq:vector(p,d,q)] \
  [,PDQ:vector(P,D,Q),seasonal:s] [,fitmean:T or F] \
  [,cast:m] [,cycles:ncyc] [,sigmasq:sigmasq] [,neg2logL:F],
  [,residuals:T] [,logdet:T] [,sigmahatsq:T] [,all:T]
  [,masign:1 or -1] [,arsign:1 or -1])
  nonMISSING REAL vector y, optional nonMISSING REAL matrix x,
  integers p, d, q, P, D, Q, m, ncyc, >= 0, integer s > 0,
  sigmasq REAL scalar > 0 or MISSING



Keywords: arima models, time domain
Macro to compute -2*log(L) and other quantities for an ARIMA model with
specified parameters.  L is the likelihood or concentrated likelihood.

The calling sequence is very similar to that of arima(), except you must
provide values of the coefficients and there are keywords which specify
what is returned.

Usage:
 neg2logLarma(y,b, [,x:x], [pdq:vector(p,d,q)] \
  [,PDQ:vector(P,D,Q),seasonal:s] [,fitmean:T or F] \
  [, sigmasq:sigmasq] [,cast:m] [cycles:ncyc] [,neg2logL:F],
  [,masign:Masign] [,arsign:Arsign]\
  [,residuals:T] [,logdet:T] [,sigmahatsq:T] [,all:T])

y is a real nonmissing vector of length n (the response)
b = vector(mu, beta, phi, theta, phiS, thetaS) of coefficients (mu =
   mean of mean difference, beta = slopes of linear predictors, phi =
   non-seasonal AR coefficients, theta = non-seasonal MA coefficients,
   phiS = seasonal AR coefficients, thetaS = non-seasonal MA
   coefficients).  Any parts that are not needed are NULL or omitted.
x = optional non-MISSING REAL matrix of linear predictors, with
   nrows(x) = nrows(y)
p, d, q >= 0 are integers specifying the non-seasonal ARIMA component
P, D, Q >= 0 are integers specifying the seasonal ARIMA component
s > 1 an integer specifying the season length; required with any of P,
  D or Q non-zero
fitmean:T means mu is in the model; fitmean:F means mu is not in
  model.  The defualt is T when d = D = 0 and F otherwise
sigmasq a REAL scalar, either MISSING or positive.  If MISSING (the
  default) the innovation variance is estimated and the "concentrated"
  log likelihood is computed.  Otherwise, the log(L) is computed
  assuming innovation variance sigmasq
m >= 0 and ncyc >= 0 are integers controlling backcasting in computing
  residuals.  See arima() and arimares() for more information.
Arsign and Masign must be +1 or -1 and control what sign convention is
  used for coefficients.  See topics 'MASIGN' and 'ARSIGN' for details.

What is returned is controlled by keywords 'neg2logL', 'residuals',
'logdet', 'sigmahatsq' and 'all'.

  Keyword                Value returned
 neg2logL:T    -2*log(L).  When sigmasq is MISSING, L is the
                           concentrated likelihood
 residuals:T   vector of residuals, including backcast ones
 logdet:T      log(det(Gamma)) where sigmasq*Gamma is covariance matrix
 sigmahatsq:T  The estimated innovation variance when sigmasq is MISSING
               or sigmasq, otherwise
 all:T         Same neg2logL:T,residuals:T,logdet:T,sigmahatsq:T

If more than items is to be returned, the output is a structure with
the keywords as component names; if only one is T, the output is a
scalar or vector.  With all:T you can suppress a result by, say,
'residuals:F',

To get the concentrated likelihood for an ordinary ARMA(p,q) model, use
  Cmd> result <- neg2logLarma(y,vector(mu,phi,theta), pdq:vector(p,0,q))

For an ARIMA model with d > 0 and zero mean differences, use
  Cmd> result <- neg2logLarma(y,vector(phi,theta), pdq:vector(p,d,q))

For a seasonal (p,q)x(P,Q) seasonal ARMA with no differences and, say
quarterly data, use
  Cmd> result <- neg2logLarma(y,vector(mu,phi,theta),\
    pdq:vector(p,0,q),PDQ:vector(P,0,Q),season:4)

For a seasonal (p,d,q)x(P,D,Q) seasonal ARIMA with no differences and,
say quarterly data, use
  Cmd> result <- neg2logLarma(y,vector(phi,theta),\
    pdq:vector(p,d,q),PDQ:vector(P,D,Q),season:4)

For an ARMA(p,q) model with mean that is cubic in time, try
  Cmd> predictors <- (run(n) - (n+1)/2)^run(0,3)'

  Cmd> result <- neg2logLarma(y,vector(beta,phi,theta),x:predictors,\
      pdq:vector(p,0,q), fit meanF) # beta a vector of length 4

Use arimahelp() to also see topic arima().


Gary Oehlert 2003-01-15