Saturday 15 May 2010

time series - Interpolate the missing quarter with R -


I have a time series with quarters from 2005 to 2011. I have some missing quarters, so I want to highlight the progressive series. My series:

  from time to time & lt; -k (14881.3, 14989.6, 15021.1, 15190.3, 15275, 15336.7, 15431.3, 15433.7, 15538.4, 15606.6, 15779.9, 15916.2, 15831.7, 16010.4, 16205.6, 16340.02, 16447.40142, 16581.81725, 16675 0.9 0362, 16799.3577, NA, NA, NA, 17128.74, NA, NA, NA, 17586.85) library (tempdisagg) time.A & lt; - ts (time, frequency = 4, start = 2005) time.A Qtr1 Qtr2 Qtr3 Qtr4 2005 14881.30 14989.60 15021.10 15190.30 2006 15275.00 15336.70 15431.30 15433.70 2007 15538.40 15606.60 15779.90 159 16.20 2008 15831.70 16010.40 16205.60 16340.02 2009 16447.40 16581.82 16675.90 1679 9.36 2010 NA NA 17128.74 2011 NA NA No 17586.85  

I tried to do with TD ceremony:

  MDL & lt; - TD (time.A ~ 0, conversion = "last", method = "Denton-Cholette")  

But I get an error because of NAS. Is there a function like na.rm = T ? Anyway, I can use the annual version of the series to solve this problem.

  time.b.  

I replace my missing the quarter with an estimated quarter but me It seems that I should use the information about the other quarters and not only the annual series. You can easily do your series:

  zoo :: na.approx (time.A) Qtr1 Qtr2 Qtr3 Qtr4 2005 14881.30 14989.60 15021.10 15190.30 2006 15275.00 15336.70 15431.30 15433.70 2007 15538.40 15606.60 15779.90 15 9 16.20 2008 15831.70 16010.40 16205.60 16340.02 2009 16447.40 16581.82 16675.90 16799.36 2010 16881.70 16964.05 17046.39 17128.74 2011 17243.27 17357.79 17472.32 17586, 85  

No comments:

Post a Comment