Simulate the white noise model
The white noise (WN) model is a basic time series model. It is also a basis for the more elaborate models we will consider. We will focus on the simplest form of WN, independent and identically distributed data.
The arima.sim()
function can be used to simulate data from a variety of time series models. ARIMA is an abbreviation for the autoregressive integrated moving average class of models we will consider throughout this course.
An ARIMA(p, d, q) model has three parts, the autoregressive order p
, the order of integration (or differencing) d
, and the moving average order q
. We will detail each of these parts soon, but for now we note that the ARIMA(0, 0, 0) model, i.e., with all of these components zero, is simply the WN model.
In this exercise, you will practice simulating a basic WN model.
This is a part of the course
“Time Series Analysis in R”
Exercise instructions
- Use
arima.sim()
to simulate from the WN model withlist(order = c(0, 0, 0))
. Set then
argument equal to100
to produce 100 observations. Save this data aswhite_noise
. - Plot your
white_noise
object usingts.plot()
. - Replicate your original call to
arima.sim()
but this time set themean
argument to100
and thesd
argument to10
. Save this data aswhite_noise_2
. - Plot your
white_noise_2
object with another call tots.plot()
.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Simulate a WN model with list(order = c(0, 0, 0))
white_noise <- arima.sim(model = ___, n = ___)
# Plot your white_noise data
# Simulate from the WN model with: mean = 100, sd = 10
white_noise_2 <- arima.sim(model = ___, n = ___, mean = ___, sd = ___)
# Plot your white_noise_2 data