CS计算机代考程序代写 F70TS – Time Series Computer Lab Week 2

F70TS – Time Series Computer Lab Week 2
In this computer lab we will use simulation to explore two common models for time series data – moving average (MA) and autoregressive (AR) processes. By generating simulated time series according to the two models, we can examine the statistical properties, and compare them to theoretical results.
Key R Commands To explore these processes we will rely on 3 functions from the R stats package. A brief introduction is provided here, but for more information please consult the R Documentation.
1. To generate data according to MA and AR models, we use the arima.sim() function. For our purposes, the function should be called as
arima.sim(model, n)
where model is a list containing the AR and/or MA coefficients, and n is the length of the series to be generated. As a simple example, the following generates a series of length 10 from an AR(2) process:
n <- 10 ar <- c(0.1, 0.2) model <- list(ar = ar) generated_series <- arima.sim(model, n) 2. To estimate the ACF of an observed time series, the function acf() should be used. For our purposes this should simply be called as acf(series, lag.max=k) where k is the maximum lag for which the ACF should be estimated. 3. Finally,thetheoreticalACFofARMAprocessescanbecomputedusingthefunctionARMAacf(). ARMAacf(ar=ar, ma=ma, lag.max=k) where ar and ma are numeric vectors containing the AR and MA coefficients respectively. Exercise 1. Generate a time series of length n = 500 from an MA(p) process, where p = 1, with coefficient of your choice. Plot the time series, with an appropriate title and axis labels. 2. Calculate an estimate of the ACF for this data, and compare to the theoretical ACF for the model, with maximum lag k = 30. Produce a plot to visually compare the estimated and theoretical ACFs. 3. Explore different values for the coefficient. How do changes affect the data, and ACF? 4. Repeat for p = 2 and p = 3, exploring how the behaviour changes as you alter the coefficients. 5. Repeat the above for an AR(p) process. For p = 2, explore the behaviour observed in different regions of the stationarity triangle by altering coefficient values. 1