-1
$\begingroup$

How do we simulate values of $Y_t$ for a maximum value of $t=60$ when we have an INAR(1) process as follows:
$Y_t=ρ^*Y_{(t-1)}+R_t$ where
$t$ takes values from 1 to 60,
$ρ=0.3,0.8$,
$ρ^*$ is the thinning,
$R_t$ is assumed to follow Poisson distribution with rate

$λ_t$ = $exp(β_0 +β_1x_{1t})$ where $β_0=β_1=1$
We are required to simulate values for a 100 Monte Carlo experiments.

$\endgroup$

closed as off-topic by Robert Long, Peter Flom Apr 23 at 11:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Robert Long, Peter Flom
If this question can be reworded to fit the rules in the help center, please edit the question.

1
$\begingroup$

The definition of the INAR(1) process leads to a straightforward simulation implementation: if $$𝑌_𝑡=ρ\circ 𝑌_{𝑡−1}+𝑅_𝑡$$ this means that$$𝑌_𝑡=\sum_{i=1}^{Y_{𝑡−1}}\zeta_{it}+𝑅_𝑡$$where $$\zeta_{it}\stackrel{\text{iid}}{\sim} \mathcal B(1,\rho)\qquad R_t\sim\cal P(\lambda_t)$$i.e.$$ρ\circ 𝑌_{𝑡−1}\sim\mathcal B\text{in}(𝑌_{𝑡−1},\rho)$$Hence the R code for simulating $Y_t$ given $Y_{t-1}$ and $\lambda_t$ could be

Y[t]=rbinom(1,Y[t-1],rho)+rpois(1,lambda[t])

Resulting in a graph like the following

enter image description here

where blue stands for the $y_t$'s and gold for the $x_t$'s

$\endgroup$
  • $\begingroup$ Is it mandatory to create a function for the variable $Y[t]$? $\endgroup$ – Shifa Apr 23 at 10:31
  • 1
    $\begingroup$ This is an R programming (and unclear) question, unrelated to the simulation and the forum. $\endgroup$ – Xi'an Apr 23 at 10:43

Not the answer you're looking for? Browse other questions tagged or ask your own question.