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
This exercise is part of the course
Time Series Analysis in R
Learn the core techniques necessary to extract meaningful insights from time series data.
In this chapter, you will conduct some trend spotting, and learn the white noise (WN) model, the random walk (RW) model, and the definition of stationary processes.
Exercise 1: Trend spotting!Exercise 2: Random or not random?Exercise 3: Name that trendExercise 4: Removing trends in variability via the logarithmic transformationExercise 5: Removing trends in level by differencingExercise 6: Removing seasonal trends with seasonal differencingExercise 7: The white noise (WN) modelExercise 8: Simulate the white noise modelExercise 9: Estimate the white noise modelExercise 10: The random walk (RW) modelExercise 11: Simulate the random walk modelExercise 12: Simulate the random walk model with a driftExercise 13: Estimate the random walk modelExercise 14: Stationary processesExercise 15: Stationary or not?Exercise 16: Are the white noise model or the random walk model stationary?What is DataCamp?
Learn the data skills you need online at your own pace—from non-coding essentials to data science and machine learning.