Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to generate a code in R that simulates a stocastic process defined by where

ID: 3251815 • Letter: H

Question

How to generate a code in R that simulates a stocastic process defined by

where mu is a constant and epsilon is the Gaussian white noise (mean = 0, variance = 1).

Generate a trace plot for Xt.

Create autocorrelation function (ACF) plot for Xt and Xt^2 using R function acf

6. Suppose that a random variable x is the number of occurrences of an event over a unit of time and it follows a Poisson distribution with mean A. Let Ti,T,... be the interarrival times of the occurrences. In class, we showed that Ti and Tr are exponential random variables with A. 1t can also be shown that, in general, Th (m 1, 2, 3, 4 are ii d. exponential random variables with a (Proposition 1 on page 26 in the notes). Note that k if and only if TG S 1 and 1. Using these facts, the following algorithm generates a realization of x (assuming that uniforms generated are independent of one another): 1. Set x and T 2. Generate U uniform (0,1) and let Y 3. Set T T Y. 4. If T 1, output X; else set X X 1 and go to step 2. X. Create a histogram for X and compute the mean of these 1000 values.

Explanation / Answer

Answer: Use the code below to obtain the things asked in the question. Do not change the code otherwise it might not work.

#### R CODE #####

rm(list=ls(all=TRUE))
mu=0
alpha0=0.4
alpha1=0.8
beta=0.5
X=rep()
X[1]=0
N=1500
Eps=rnorm(1501)
Sigma=rep()
Sigma[2] = alpha0 + alpha1 * X[1]^2
for(i in 2:(N+1))
{
X[i] = mu + sqrt(Sigma[i])*Eps[i]
Sigma[i+1] = alpha0 + alpha1 * X[i]^2 + beta * Sigma[i]
}

X=X[-(1:501)]
length(X)
X=as.ts(X)

plot(X)

acf(X)
pacf(X)

acf(X^2)
pacf(X^2)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote