Title: | (Semi)Parametric Estimation and Bootstrapping of INAR Models |
---|---|
Description: | Semiparametric and parametric estimation of INAR models including a finite sample refinement (Faymonville et al. (2022) <doi:10.1007/s10260-022-00655-0>) for the semiparametric setting introduced in Drost et al. (2009) <doi:10.1111/j.1467-9868.2008.00687.x>, different procedures to bootstrap INAR data (Jentsch, C. and Weiß, C.H. (2017) <doi:10.3150/18-BEJ1057>) and flexible simulation of INAR data. |
Authors: | Maxime Faymonville [aut, cre] |
Maintainer: | Maxime Faymonville <[email protected]> |
License: | GPL (>= 3) |
Version: | 0.2.0 |
Built: | 2025-03-04 04:34:41 UTC |
Source: | https://github.com/mfaymon/spinar |
Semiparametric and parametric estimation of INAR models including a finite sample refinement for the semiparametric setting, different procedures to bootstrap INAR data and flexible simulation of INAR data.
The package provides a flexible simulation of INAR data by inserting a user-defined
pmf argument in the spinar_sim
function. Using spinar_est
,
it allows for semiparametric estimation of the INAR model along Drost et al. (2009)
and additionally, it includes a small sample refinement spinar_penal
(Faymonville et al., 2022) together with a validation of the upcoming penalization
parameters (spinar_penal_val
). Furthermore, it contains a semiparametric
INAR bootstrap procedure implemented in spinar_boot
(Jentsch and Weiß, 2017).
In addition to the semiparametric model, the package also allows for parametric simulation
(spinar_sim
), parametric estimation (spinar_est_param
) and
parametric bootstrapping (spinar_boot
) of INAR data.
Maintainer: Maxime Faymonville [email protected] (ORCID)
Authors:
Javiera Riffo [email protected] (ORCID)
Jonas Rieger [email protected] (ORCID)
Carsten Jentsch [email protected] (ORCID)
Other contributors:
Christian H. Weiß [email protected] (ORCID) [contributor]
Faymonville, M., Riffo, J., Rieger, J. and Jentsch, C. (2024). "spINAR: An R Package for Semiparametric and Parametric Estimation and Bootstrapping of Integer-Valued Autoregressive (INAR) Models". Journal of Open Source Software 9(97), pp. 5386. doi:10.21105/joss.05386.
Faymonville, M., Jentsch, C., Weiß, C.H. and Aleksandrov, B. (2022). "Semiparametric Estimation of INAR Models using Roughness Penalization". Statistical Methods & Applications. doi:10.1007/s10260-022-00655-0.
Jentsch, C. and Weiß, C. H. (2017), "Bootstrapping INAR Models". Bernoulli 25(3), pp. 2359–2408. doi:10.3150/18-BEJ1057.
Drost, F., Van den Akker, R. and Werker, B. (2009), "Efficient estimation of auto-regression parameters and innovation distributions for semiparametric integer-valued AR(p) models". Journal of the Royal Statistical Society. Series B 71(2), pp. 467–485. doi:10.1111/j.1467-9868.2008.00687.x.
Useful links:
INAR bootstrap procedures for the semiparametric and the parametric INAR setting, where the latter allows for moment- and maximum likelihood-based estimation and Poisson, geometrically and negative binomially distributed innovations.
spinar_boot( x, p, B, setting, type = "mom", distr = "poi", M = 100, level = 0.05, progress = TRUE )
spinar_boot( x, p, B, setting, type = "mom", distr = "poi", M = 100, level = 0.05, progress = TRUE )
x |
[ |
p |
[ |
B |
[ |
setting |
[ |
type |
[ |
distr |
[ |
M |
[ |
level |
[ |
progress |
[ |
[named list
] with entries
x_star
[matrix
] of bootstrap observations with
length(x)
rows and B
columns.
parameters_star
[matrix
] of bootstrap estimated
parameters with B
rows.
If setting = "sp"
, each row contains
the estimated coefficients and the
estimated entries of the pmf
, ... where
represents the probability of an innovation being equal
to
.
If
setting = "p"
, each row contains the estimated
coefficients and the estimated
parameter(s) of the innovation distribution.
bs_ci_percentile
[named matrix
] with the lower and
upper bounds of the bootstrap percentile confidence intervals for each
parameter in parameters_star
.
bs_ci_hall
[named matrix
] with the lower and
upper bounds of Hall's bootstrap percentile confidence intervals for each
parameter in parameters_star
.
# generate data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = dgeom(0:60, 0.5)) # semiparametric INAR(1) bootstrap spinar_boot(x = dat1, p = 1, B = 50, setting = "sp") # parametric Geo-INAR(2) bootstrap using moment-based estimation spinar_boot(x = dat2, p = 2, B = 50, setting = "p", type = "mom", distr = "geo")
# generate data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = dgeom(0:60, 0.5)) # semiparametric INAR(1) bootstrap spinar_boot(x = dat1, p = 1, B = 50, setting = "sp") # parametric Geo-INAR(2) bootstrap using moment-based estimation spinar_boot(x = dat2, p = 2, B = 50, setting = "p", type = "mom", distr = "geo")
Semiparametric estimation of the autoregressive parameters and the innovation
distribution of INAR(p
) models, . The
estimation is conducted by maximizing the conditional likelihood of the model.
spinar_est(x, p)
spinar_est(x, p)
x |
[ |
p |
[ |
Vector containing the estimated coefficients and the estimated entries
of the pmf
,... where
represents the probability of
an innovation being equal to
.
# generate data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = c(0.25, 0.2, 0.15, 0.1, 0.1, 0.1, 0.1)) # semiparametric estimation of INAR(1) model spinar_est(x = dat1, p = 1) # semiparametric estimation of INAR(2) model spinar_est(x = dat2, p = 2)
# generate data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = c(0.25, 0.2, 0.15, 0.1, 0.1, 0.1, 0.1)) # semiparametric estimation of INAR(1) model spinar_est(x = dat1, p = 1) # semiparametric estimation of INAR(2) model spinar_est(x = dat2, p = 2)
Parametric estimation of the autoregressive parameters and the innovation distribution of INAR(p
) models,
, with Poisson, geometrically or negative binomially distributed innovations. The estimation can either be
moment- or maximum likelihood-based.
spinar_est_param(x, p, type, distr)
spinar_est_param(x, p, type, distr)
x |
[ |
p |
[ |
type |
[ |
distr |
[ |
Named vector containing the estimated coefficients and the estimated parameter(s)
of the innovation distribution.
# generate data # Poi-INAR(1) data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = dpois(0:20, 1)) # Geo-INAR(2) data dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = dgeom(0:60, 0.5)) # NB-INAR(1) data dat3 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = dnbinom(0:40, 2, 2/3)) # moment-based parametric estimation of Poi-INAR(1) model spinar_est_param(x = dat1, p = 1, type = "mom", distr = "poi") # moment-based parametric estimation of Geo-INAR(2) model spinar_est_param(x = dat2, p = 2, type = "mom", distr = "geo") # maximum likelihood-based parametric estimation of NB-INAR(1) model spinar_est_param(x = dat3, p = 1, type = "ml", distr = "nb")
# generate data # Poi-INAR(1) data dat1 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = dpois(0:20, 1)) # Geo-INAR(2) data dat2 <- spinar_sim(n = 200, p = 2, alpha = c(0.2, 0.3), pmf = dgeom(0:60, 0.5)) # NB-INAR(1) data dat3 <- spinar_sim(n = 200, p = 1, alpha = 0.5, pmf = dnbinom(0:40, 2, 2/3)) # moment-based parametric estimation of Poi-INAR(1) model spinar_est_param(x = dat1, p = 1, type = "mom", distr = "poi") # moment-based parametric estimation of Geo-INAR(2) model spinar_est_param(x = dat2, p = 2, type = "mom", distr = "geo") # maximum likelihood-based parametric estimation of NB-INAR(1) model spinar_est_param(x = dat3, p = 1, type = "ml", distr = "nb")
Semiparametric penalized estimation of the autoregressive parameters and the innovation distribution of INAR(p
) models,
. The estimation is conducted by maximizing the penalized conditional likelihood of the model. If both
penalization parameters are set to zero, the function coincides to the spinar_est function of this package.
spinar_penal(x, p, penal1 = 0, penal2 = 0)
spinar_penal(x, p, penal1 = 0, penal2 = 0)
x |
[ |
p |
[ |
penal1 |
|
penal2 |
|
Vector containing the penalized estimated coefficients and the penalized
estimated entries of the pmf
,... where
represents the probability of
an innovation being equal to
.
# generate data dat1 <- spinar_sim(n = 50, p = 1, alpha = 0.5, pmf = c(0.3, 0.25, 0.2, 0.15, 0.1)) # penalized semiparametric estimation spinar_penal(x = dat1, p = 1, penal1 = 0, penal2 = 0.1)
# generate data dat1 <- spinar_sim(n = 50, p = 1, alpha = 0.5, pmf = c(0.3, 0.25, 0.2, 0.15, 0.1)) # penalized semiparametric estimation spinar_penal(x = dat1, p = 1, penal1 = 0, penal2 = 0.1)
Semiparametric penalized estimation of the autoregressive parameters and the innovation distribution of INAR(p
) models,
. The estimation is conducted by maximizing the penalized conditional likelihood of the model.
Included is a possible validation of one or both penalization parameters. If no validation is wanted, the function coincides
to the spinar_penal function of this package.
spinar_penal_val( x, p, validation, penal1 = NA, penal2 = NA, over = NA, folds = 10, init1 = 1, init2 = 1, progress = TRUE )
spinar_penal_val( x, p, validation, penal1 = NA, penal2 = NA, over = NA, folds = 10, init1 = 1, init2 = 1, progress = TRUE )
x |
[ |
p |
[ |
validation |
[ |
penal1 |
[ |
penal2 |
[ |
over |
[ |
folds |
[ |
init1 |
[ |
init2 |
[ |
progress |
[ |
If validation = FALSE
, the function returns a vector containing the penalized estimated coefficients
and the penalized estimated entries of the pmf
... where
represents the probability of
an innovation being equal to
.
If validation = TRUE
, the function returns a named list, where the first entry contains
the penalized estimated coefficients and the penalized estimated entries of the pmf
,... where
represents the probability of
an innovation being equal to
. The second (and if
over = both
also the third entry) contain(s) the validated penalization parameter(s).
# generate data dat1 <- spinar_sim(n = 50, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) # penalized semiparametric estimation with validation over L1 spinar_penal_val(x = dat1, p = 1, validation = TRUE, penal2 = 0.1, over = "L1") # penalized semiparametric estimation with validation over both L1 and L2 spinar_penal_val(x = dat1, p = 1, validation = TRUE, over = "both")
# generate data dat1 <- spinar_sim(n = 50, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) # penalized semiparametric estimation with validation over L1 spinar_penal_val(x = dat1, p = 1, validation = TRUE, penal2 = 0.1, over = "L1") # penalized semiparametric estimation with validation over both L1 and L2 spinar_penal_val(x = dat1, p = 1, validation = TRUE, over = "both")
Generating INAR(p) observations,
where p
. It allows for general pmfs
which can be generated parametrically or "manually" (semiparametrically).
spinar_sim(n, p, alpha, pmf, prerun = 500)
spinar_sim(n, p, alpha, pmf, prerun = 500)
n |
[ |
p |
[ |
alpha |
[ |
pmf |
[ |
prerun |
[ |
Vector with INAR(
p
) observations.
# generate (semiparametrically) 100 INAR(1) observations with # alpha_1 = 0.5 and a manually set pmf spinar_sim(n = 100, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) # generate 100 obervations of an INAR(2) model with # alpha_1 = 0.2, alpha_2 = 0.3 and Poi(1)-innovations spinar_sim(n = 100, p = 2, alpha = c(0.2, 0.3), pmf = dpois(0:20,1))
# generate (semiparametrically) 100 INAR(1) observations with # alpha_1 = 0.5 and a manually set pmf spinar_sim(n = 100, p = 1, alpha = 0.5, pmf = c(0.3, 0.3, 0.2, 0.1, 0.1)) # generate 100 obervations of an INAR(2) model with # alpha_1 = 0.2, alpha_2 = 0.3 and Poi(1)-innovations spinar_sim(n = 100, p = 2, alpha = c(0.2, 0.3), pmf = dpois(0:20,1))