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

Description Usage Arguments Value Details References Examples

Description

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

Usage

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

Arguments

Y

A vector for the k observed data.

time

A vector for the k observation times.

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, α_1, α_2, β_1, H, and σ for CARFIMA(2,H,1).

fitted

If TRUE, fitted values and AIC are returned as a list. FALSE flag returns a value of the log likelihood.

Value

Either a list of fitted values(fitted) and AIC(AIC), or a numeric value of the log likelihood.

Details

The function carfima.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 the reference for details.

References

\insertRef

tsai_note_2000carfima

\insertRef

tsai_maximum_2005carfima

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
##### Irregularly spaced observation time generation.
length.time <- 100
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.75, 0.2)
# AR parameter alpha = -0.4
# Hurst parameter = 0.75
# process uncertainty (standard deviation) sigma = 0.2
y <- carfima.sim(parameter = parameter, time = time, ar.p = 1, ma.q = 0)

##### Compute
output = carfima::carfima.loglik(Y=y,time=time,ar.p=1,ma.q=0,parameter=parameter,fitted=TRUE)

kisungyou/carfima documentation built on May 13, 2019, 5:24 p.m.