carfima.loglik {carfima}R Documentation

Computing the log likelihood function of a CARFIMA(p, H, q) model


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


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



A vector for the k observed data.


A vector for the k observation times.


(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.


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.


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


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).


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


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.


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


Hyungsuk Tak, Henghsiu Tsai, Kisung You


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.


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

  y <- carfima.sim(parameter = parameter, time = time, 
                   measure.error =, 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 =,
                           parameter = parameter, fitted = FALSE)

[Package carfima version 2.0.2 Index]