How to analyse irregular time-series in R

前端 未结 1 1316
悲哀的现实
悲哀的现实 2020-12-24 15:03

I have a zoo time series in R:

d <- structure(c(50912, 50912, 50912, 50912, 50913, 50913, 50914, 
50914, 50914, 50915, 50915, 50915, 50916, 5         


        
相关标签:
1条回答
  • 2020-12-24 15:35

    I have analysed such irregular data in the past using an additive model to "decompose" the seasonal and trend components. As this is a regression-based approach you need to model the residuals as a time series process to account for lack of independence in the residuals.

    I used the mgcv package for these analysis. Essentially the model fitted is:

    require(mgcv)
    require(nlme)
    mod <- gamm(response ~ s(dayOfYear, bs = "cc") + s(timeOfSampling), data = foo,
                correlation = corCAR1(form = ~ timeOfSampling))
    

    Which fits a cyclic spline in the day of the year variable dayOfYear for the seasonal term and the trend is represented by timeOfSampling which is a numeric variable. The residuals are modelled here as a continuous-time AR(1) using the timeOfSampling variable as the time component of the CAR(1). This assumes that with increasing temporal separation, the correlation between residuals drops off exponentially.

    I have written some blog posts on some of these ideas:

    1. Smoothing temporally correlated data
    2. Additive modelling and the HadCRUT3v global mean temperature series

    which contain additional R code for you to follow.

    0 讨论(0)
提交回复
热议问题