Description Usage Arguments Value Author(s) References Examples
View source: R/inars_fit_function.R
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, ....
1 2 3 4 5 6 7 8 |
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 ( |
method |
Estimation method of the parameters. Maximum conditional
likelihood ( |
optim.control |
List of control parameters for |
... |
further arguments to be passed to |
The inars
function returns an object of class
"inars
", which consists of a list with the following
components:
The parameters estimates.
One-step ahead conditional mean forecasts.
A vector of raw residuals (Yt - E(Yt | Yt-1)).
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
.
Conditional log-likelihood of the fitted model,
if method = "CML"
.
Number of observations.
The assumed distribution for the innovation process.
Estimation method of the parameters.
The function call.
The formula used to specify the model in
inars
.
The response vector, and the model matrix.
Output from the optim call for
maximizing the conditional log-likelihood, if
method = "CML"
.
logical indicating successful convergence of
optim, if method = "CML"
.
The control arguments passed to the
optim call, if method = "CML"
.
Rodrigo M. R. Medeiros <rodrigo.matheus@live.com>
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.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.