spinar_sim {spINAR}R Documentation

Simulation of (semi)parametric integer autoregressive (INAR) models

Description

Generating INAR(p) observations, where p \in \{1,2\}. It allows for general pmfs which can be generated parametrically or "manually" (semiparametrically).

Usage

spinar_sim(n, p, alpha, pmf, prerun = 500)

Arguments

n

[integer(1)]
number of observations.

p

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

alpha

[integer(p)]
vector of INAR coefficients \code{alpha}_1,...,\code{alpha}_p.

pmf

[numeric]
vector of probability mass function \code{pmf}_0,..., \code{pmf}_k where \code{pmf}_i represents the probability of an innovation being equal to i.

prerun

[integer(1)]
number of observations which are generated additionally and then omitted (to ensure stationarity).

Value

Vector with n INAR(p) observations.

Examples

# 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))


[Package spINAR version 0.2.0 Index]