Dear Gabor, Paul and Ryan, Many thanks for all your guidance concerning the application of the filter/smoother. I need to temporally smooth 32 years 5 km resolution bi-monthly global NDVI dataset. On average each pixel have got up to 768 cases/images with data missing at random. I consider the data to be large and with the nature of missing data, applying the filter manually might be tricky. I have run a function which kind of combines Gabor and Paul's suggestion " sgolayfilt(zoo::na.spline(ydata)) " as suggested by Ryan (cc'd here) on a few sampled time series data and observed/projections are generally matching well. If i understand the function, it first fill in NAs with spline curve fits from zoo package and run Savitzky-Golay filter on a continuous data. The problem is that data/observations on the end points (like first and last 5 or 10) are poorly projected with some projections being off the possible values that NDVI can take. Can we adjust the algorithm such that the problem is controlled? Thanks for your time.
Kind regards, Erick. On Sat, Sep 27, 2014 at 2:23 AM, Gabor Grothendieck <ggrothendi...@gmail.com > wrote: > On Fri, Sep 26, 2014 at 3:32 AM, Erick Okuto <erickok...@gmail.com> wrote: > > Dear Paul and Henrik, > > I have a time series with some missing data points that i need smoothed > > using Savitzky-Golay filter. Related question was asked here > > > http://thr3ads.net/r-help/2012/11/2121748-Savitzky-Golay-filtering-with-missing-data > > but no straight forward answer was posted. However, Henrik (cc'd here) > did > > ask related question on smoothing for reflectance here > > > http://thr3ads.net/r-help/2004/02/835137-Savitzky-Golay-smoothing-for-reflectance-data > > which i have as well been unable to follow up. I will be glad if you > could > > assist me with some insights on the way forward or point to a relevant > > source of help. > > > Not Savitzky-Golay but if z is a time series then > > library(zoo) > na.spline(z) > > will fill in NAs with spline curve fits. See ?na.spline > > There are other NA filling routines in zoo too: > > > ls(pattern = "^na[.]", "package:zoo") > [1] "na.aggregate" "na.aggregate.default" "na.approx" > [4] "na.approx.default" "na.fill" "na.fill.default" > [7] "na.locf" "na.locf.default" "na.spline" > [10] "na.spline.default" "na.StructTS" "na.trim" > [13] "na.trim.default" "na.trim.ts" > > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com > -- *Erick Okuto, Ph.D.* * Candidate* *School of Mathematics & Actuarial Science* *Jaramogi Oginga Odinga University of Science & Technology (JOOUST)/ World Agroforestry Centre (ICRAF), **Climate Change Unit, Nairobi-Kenya. * Voice: +254207224154 Mobile: +254725005276 Skype id: erickokuto Email: erickok...@gmail.com [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.