carfima.loglik: Computing the log likelihood function of a CARFIMA(p, H, q)...

Description Usage Arguments Details Value Author(s) References Examples

View source: R/carfima.R

Description

This function evaluates the log likelihood function of a CARFIMA(p, H, q) model as specified in Tsai and Chan (2005).

Usage

1
carfima.loglik(Y, time, measure.error, ar.p, ma.q, parameter, fitted = FALSE)

Arguments

Y

A vector for the k observed data.

time

A vector for the k observation times.

measure.error

(Optional) A vector for the k measurement error standard deviations, if such information is available (especially for astronomical applications). A vector of zeros is automatically assigned, if nothing is specified.

ar.p

A positive integer for the order of the AR model. ar.p must be greater than ma.q. If ar.p is greater than 2, numerical errors may occur for both methods.

ma.q

A non-negative integer for the order of the MA model. ma.q must be smaller than ar.p.

parameter

The values of the unknown parameters at which the log likelihood is evaluated. For example, users need to specify five values of α_1, α_2, β_1, H, and σ for CARFIMA(2, H, 1).

fitted

If "TRUE", fitted values and AIC are returned. If "FALSE", a value of the log likelihood is returned. Default is "FALSE".

Details

The function carfiam.loglik computes the log likelihood of a CARFIMA(p, H, q) model via the innovation algorithm whose computational cost increases linearly as the size of the data increases; see Tsai and Chan (2005) for details.

Value

The outcome of carfima is the value of the log likelihood if "fitted = FALSE" and both AIC and fitted values if "fitted = TRUE".

Author(s)

Hyungsuk Tak, Henghsiu Tsai, Kisung You

References

H. Tsai and K.S. Chan (2005) "Maximum Likelihood Estimation of Linear Continuous Time Long Memory Processes with Discrete Time Data," Journal of the Royal Statistical Society (Series B), 67 (5), 703-716. DOI: 10.1111/j.1467-9868.2005.00522.x

H. Tsai and K.S. Chan (2000) "A Note on the Covariance Structure of a Continuous-time ARMA Process," Statistica Sinica, 10, 989-998.
Link: http://www3.stat.sinica.edu.tw/statistica/j10n3/j10n317/j10n317.htm

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  ##### Irregularly spaced observation time generation.


  length.time <- 30
  time.temp <- rexp(length.time, rate = 2)
  time <- rep(NA, length.time + 1)
  time[1] <- 0
  for (i in 2 : (length.time + 1)) {
    time[i] <- time[i - 1] + time.temp[i - 1]
  }
  time <- time[-1]

  ##### Data genration for CARFIMA(1, H, 0) based on the observation times. 

  parameter <- c(-0.4, 0.8, 0.2) 
  # AR parameter alpha = -0.4
  # Hurst parameter = 0.8
  # Process uncertainty (standard deviation) sigma = 0.2

  me.sd <- rep(0.05, length.time)
  # Known measurement error standard deviations 0.05 for all observations
  # If not known, remove the argument "measure.error = me.sd" in the following codes,
  # so that the default values (zero) are automatically assigned.

  y <- carfima.sim(parameter = parameter, time = time, 
                   measure.error = me.sd, ar.p = 1, ma.q = 0)  

  ##### Computing the log likelihood of the CARFIMA(1, H, 0) model given the parameters.
  loglik <- carfima.loglik(Y = y, time = time, ar.p = 1, ma.q = 0,
                           measure.error = me.sd,
                           parameter = parameter, fitted = FALSE)

carfima documentation built on March 26, 2020, 7:28 p.m.