Aan de slagGa gratis aan de slag

Identifying the sampling frequency

In addition to viewing your data and plotting over time, there are several additional operations that can be performed on time series datasets.

The start() and end() functions return the time index of the first and last observations, respectively. The time() function calculates a vector of time indices, with one element for each time index on which the series was observed.

The deltat() function returns the fixed time interval between observations and the frequency() function returns the number of observations per unit time. Finally, the cycle() function returns the position in the cycle of each observation.

In this exercise, you'll practice applying these functions to the AirPassengers dataset, which reports the monthly total international airline passengers (in thousands) from 1949 to 1960.

Deze oefening maakt deel uit van de cursus

Time Series Analysis in R

Cursus bekijken

Oefeninstructies

  • Begin by plotting the AirPassengers data using a simple call to plot().
  • Next, list the first and last time observations in AirPassengers using start() and end(), respectively.
  • Finally, gain some additional insight into this dataset by using the time(), deltat(), frequency(), and cycle() commands AirPassengers.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Plot AirPassengers


# View the start and end dates of AirPassengers



# Use time(), deltat(), frequency(), and cycle() with AirPassengers 



Code bewerken en uitvoeren