Re: [R] completing missing samples

2011-09-18 Thread Gabor Grothendieck
On Mon, Sep 12, 2011 at 4:42 AM, Eran Eidinger wrote: > Hello, > > I have a time-series that has some missing samples. > I was thinking on completing them using either zero-order hold or linear > interpolation. > I am looking for an efiicient way (other than a loop...) of identifiying the > missin

Re: [R] completing missing samples

2011-09-18 Thread Eran Eidinger
Hello Michael, Joshua, Thanks alot for your replies, this really helps. As to my main problem - I am tryin to identify a cyclic behavior in a time-series using FFT, and I am struggiling with missing samples. It is not trivial that linear interpolation is the answer (it probably is not), but right

Re: [R] completing missing samples

2011-09-17 Thread David Winsemius
On Sep 17, 2011, at 5:04 PM, Joshua Wiley wrote: On Sat, Sep 17, 2011 at 1:43 PM, Joshua Wiley wrote: Hi Eran, You have already gotten some suggestions from Michael, but I think that Rich is correct to question the rational. I hope we should question the rationale, and doubt that Rich has

Re: [R] completing missing samples

2011-09-17 Thread Joshua Wiley
On Sat, Sep 17, 2011 at 1:43 PM, Joshua Wiley wrote: > Hi Eran, > > You have already gotten some suggestions from Michael, but I think > that Rich is correct to question the rational.  Any mechanism you > choose to replace the missing values will impose its structure on the > data. Veritate ab abs

Re: [R] completing missing samples

2011-09-17 Thread Joshua Wiley
Hi Eran, You have already gotten some suggestions from Michael, but I think that Rich is correct to question the rational. Any mechanism you choose to replace the missing values will impose its structure on the data. Veritate ab absurdo: ## data x <- sin(seq(1, 17, .1)) + seq(-.5, .5, length.out

Re: [R] completing missing samples

2011-09-17 Thread Rich Shepard
On Sat, 17 Sep 2011, R. Michael Weylandt wrote: How are your time samples missing? Michael/Eran, Pardon me for jumping in since I did not read the original message, but I have a more fundamental question: are the missing time samples meaningful? For example, a time series of precipitatio

Re: [R] completing missing samples

2011-09-17 Thread R. Michael Weylandt
How are your time samples missing? If they are recorded as NA, the na.locf() function will fill them with the previous value (zero-order hold) and with the reversability arguments can give linear interpolation: library(xts) x = c(1:5,NA,6:10) x = xts(x,Sys.Date()+0:10) na.locf(x) (na.locf(x) + n

[R] completing missing samples

2011-09-12 Thread Eran Eidinger
Hello, I have a time-series that has some missing samples. I was thinking on completing them using either zero-order hold or linear interpolation. I am looking for an efiicient way (other than a loop...) of identifiying the missing time slots and filling them. Can you think of any methods that mi