CommencerCommencer gratuitement

Simulating ARMA models

As we saw in the video, any stationary time series can be written as a linear combination of white noise. In addition, any ARMA model has this form, so it is a good choice for modeling stationary time series.

R provides a simple function called arima.sim() to generate data from an ARMA model. For example, the syntax for generating 100 observations from an MA(1) with parameter .9 is arima.sim(model = list(order = c(0, 0, 1), ma = .9 ), n = 100). You can also use order = c(0, 0, 0) to generate white noise.

In this exercise, you will generate data from various ARMA models. For each command, generate 200 observations and plot the result.

Cet exercice fait partie du cours

ARIMA Models in R

Afficher le cours

Instructions

  • Use arima.sim() and plot() to generate and plot white noise.
  • Use arima.sim() and plot() to generate and plot an MA(1) with parameter .9.
  • Use arima.sim() and plot() to generate and plot an AR(2) with parameters 1.5 and -.75.

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# Generate and plot white noise
WN <- 


# Generate and plot an MA(1) with parameter .9 
MA <- 


# Generate and plot an AR(2) with parameters 1.5 and -.75
AR <- 

Modifier et exécuter le code