Tag: time series

  • There seems to be a bug in a R package n …

    article There seems to be a bug in a R package named pgam:periodogram().
    The function intensity happened to have two cos. One of them should be sin.
    Here is the correct version.

    function (w, x)
    {
    n <- length(x) t <- seq(1:n) sp <- ((sum(x * cos(w * t)))^2 + (sum(x * sin(w * t)))^2)/n return(sp) }

  • R commands to explore time series data …

    R commands to explore time series data

    ts(data) # create time series objects
    time(ts.data) # returns the time

    diff(ts.data, lag=1) # difference at the specified lag
    lag.plot(ts.data, 9, do.lines=FALSE) # plot with specified lags

    plot(stl(ts.data, “per”)) # decomposition of time series data

    spec.pgram(ts.data, spans=c(3,3), log=”no”) # non-parametric spectral analysis
    spec.ar(ts.data, spans=c(3,3), log=”no”) # parametric estimation

    http://www.stat.pitt.edu/stoffer/tsa2/R_time_series_quick_fix.htm