MulaiMulai sekarang secara gratis

Detrending data

As you have seen in the previous exercise, differencing is generally good for removing trend from time series data. Recall that differencing looks at the difference between the value of a time series at a certain point in time and its preceding value.

In this exercise, you will use differencing diff() to detrend and plot real time series data.

Latihan ini adalah bagian dari kursus

ARIMA Models in R

Lihat Kursus

Petunjuk latihan

  • The package astsa is preloaded.
  • Generate a multifigure plot comparing the global temperature data (globtemp) with the detrended series. You can create a multifigure plot by running the pre-written par() command followed by two separate calls to plot().
  • Generate another multifigure plot comparing the weekly cardiovascular mortality in Los Angeles County (cmort) with the detrended series.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Plot globtemp and detrended globtemp
par(mfrow = c(2,1))
plot(globtemp) 


# Plot cmort and detrended cmort
par(mfrow = c(2,1))
plot(cmort)

Edit dan Jalankan Kode