inars: INARS(1) Modelling of Integer-Valued Time Series

Description Usage Arguments Value Author(s) References Examples

View source: R/inars_fit_function.R

Description

Fit the integer-valued autoregressive process of order 1 with signed binomial thinning to a univariate time series that assumes integer values in Z = ..., -2, -1, 0, 1, 2, ....

Usage

1
2
3
4
5
6
7
8
inars(
  formula,
  data,
  innovation = c("SDL", "SK", "DLOG"),
  method = c("CML", "MM"),
  optim.control = inars_control(...),
  ...
)

Arguments

formula

A representation of the model to be fitted. In the case of fit without regressors, the systematic component must be ~ 1.

data

The dataset.

innovation

The assumed distribution for the innovation process. The skew discrete Laplace ("SDL"), Skellam ("SK") and Discrete logistic ("DLOG") distributions are available.

method

Estimation method of the parameters. Maximum conditional likelihood ("CML" - default) or method of moments ("MM") estimates can be used.

optim.control

List of control parameters for optim.

...

further arguments to be passed to optim.

Value

The inars function returns an object of class "inars", which consists of a list with the following components:

estimates

The parameters estimates.

fitted.values

One-step ahead conditional mean forecasts.

residuals

A vector of raw residuals (Yt - E(Yt | Yt-1)).

vcov

Asymptotic covariance matrix of the maximum likelihood estimators of all parameters in the model obtained from the Hessian matrix if hessian = TRUE. However, if the moment estimator is used, then vcov = NULL.

logLik

Conditional log-likelihood of the fitted model, if method = "CML".

nobs

Number of observations.

innovation

The assumed distribution for the innovation process.

method

Estimation method of the parameters.

call

The function call.

formula

The formula used to specify the model in inars.

response, x

The response vector, and the model matrix.

optim

Output from the optim call for maximizing the conditional log-likelihood, if method = "CML".

converged

logical indicating successful convergence of optim, if method = "CML".

optim.control

The control arguments passed to the optim call, if method = "CML".

Author(s)

Rodrigo M. R. Medeiros <rodrigo.matheus@live.com>

References

Medeiros, R. M. R. & Bourguignon, M. (2021).

Kim, H. Y., & Park, Y. (2008). A non-stationary integer-valued autoregressive model. Statistical papers, 49, 485.

Andersson, J., & Karlis, D. (2014). A parametric time series model with covariates for integers in Z. Statistical Modelling, 14, 135–156.

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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
## Not run: 
# Dataset: tick
data(tick)
head(tick)

# Observed time series
y <-  ts(tick$tick)

########################
# Descriptive analysis #
#######################

summary(y)
sd(y)

# Distribution
barplot(table(y), xlab = "Ticks", ylab = "Frequency")

# Line plot
plot(y, xlab = "Time", ylab = "Ticks")

# Autocorrelation and partial autocorrelation functions
acf(y, main="", xlim=c(1.2,30)); axis(side=1,at=1,labels = "1")
pacf(y,main="")

##########################
# Fit of the INARS model #
#########################

# Without regressors

# SDL
fit.sdl <- inars(tick ~ 1, data = tick)

# Skellam
fit.sk <- inars(tick ~ 1, data = tick, innovation = "SK")

# Discrete logistic
fit.dlog <- inars(tick ~ 1, data = tick, innovation = "DLOG")

summary(fit.sdl)
summary(fit.sk)
summary(fit.dlog)

# AIC and BIC comparison
data.frame(innovation = c("SDL", "SK", "DLOG"),
           AIC = c(AIC(fit.sdl), AIC(fit.sk), AIC(fit.dlog)),
           BIC = c(BIC(fit.sdl), BIC(fit.sk), BIC(fit.dlog)))

# With regressor 'spread'

# SDL
fit2.sdl <- inars(tick ~ spread, data = tick)

# Skellam
fit2.sk <- inars(tick ~ spread, data = tick, innovation = "SK")

# Discrete logistic
fit2.dlog <- inars(tick ~ spread, data = tick, innovation = "DLOG")

summary(fit2.sdl)
summary(fit2.sk)
summary(fit2.dlog)

data.frame(innovation = c("SDL", "SK", "DLOG"),
           AIC = c(AIC(fit2.sdl), AIC(fit2.sk), AIC(fit2.dlog)),
           BIC = c(BIC(fit2.sdl), BIC(fit2.sk), BIC(fit2.dlog)))

# Residual analysis
plot(fit2.sdl)
plot(fit2.sk)
plot(fit2.dlog)

## End(Not run)

Rodrigo-sgj/inars documentation built on March 15, 2021, 11:52 a.m.