Learn R Programming

spINAR (version 0.2.0)

spinar_penal_val: Validated penalized semiparametric estimation of INAR models

Description

Semiparametric penalized estimation of the autoregressive parameters and the innovation distribution of INAR(p) models, \(\code{p} \in \{1,2\}\). 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.

Usage

spinar_penal_val(
  x,
  p,
  validation,
  penal1 = NA,
  penal2 = NA,
  over = NA,
  folds = 10,
  init1 = 1,
  init2 = 1,
  progress = TRUE
)

Value

If validation = FALSE, the function returns a vector containing the penalized estimated coefficients \(\code{alpha}_1,...,\code{alpha}_p\) and the penalized estimated entries of the pmf \(\code{pmf}_0, \code{pmf}_1\)... where \(\code{pmf}_i\) represents the probability of an innovation being equal to \(i\).

If validation = TRUE, the function returns a named list, where the first entry contains the penalized estimated coefficients \(\code{alpha}_1,...,\code{alpha}_p\) and the penalized estimated entries of the pmf \(\code{pmf}_0, \code{pmf}_1\),... where \(\code{pmf}_i\) represents the probability of an innovation being equal to \(i\). The second (and if over = both also the third entry) contain(s) the validated penalization parameter(s).

Arguments

x

[integer]
vector with integer observations.

p

[integer(1)]
order of the INAR model, where \(\code{p} \in \{1,2\}\).

validation

[logical(1)]
indicates whether validation is wanted.

penal1

[numeric(1)]
\(L_1\) penalization parameter. It will be ignored if validation = TRUE and over \(\in \{"both", "L_1"\}\). It is mandatory if validation = FALSE.

penal2

[numeric(1)]
\(L_2\) penalization parameter. It will be ignored if validation = TRUE and over \(\in \{"both", "L_2"\}\). It is mandatory if validation = FALSE.

over

[string(1)]
validation over "both" penalization parameters or only over "L_1" or "L_2". It is mandatory if validation = TRUE, otherwise it will be ignored.

folds

[integer(1)]
number of folds for (cross) validation.

init1

[numeric(1)]
initial value for penal1 in validation. Default value is init1 = 1.

init2

[numeric(1)]
initial value for penal2 in validation. Default value is init2 = 1

progress

[logical(1)]
Should a nice progress bar be shown? Turning it off, could lead to significantly faster calculation. Default is TRUE.

Examples

Run this code
# generate data
dat1 <- spinar_sim(n = 50, p = 1, alpha = 0.5,
                   pmf = c(0.3, 0.3, 0.2, 0.1, 0.1))

# \donttest{
# 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")# }

Run the code above in your browser using DataLab