[R] Imputing missing values in time series
Horace Tso
Horace.Tso at pgn.com
Fri Jun 22 20:44:52 CEST 2007
Folks,
This must be a rather common problem with real life time series data
but I don't see anything in the archive about how to deal with it. I
have a time series of natural gas prices by flow date. Since gas is not
traded on weekends and holidays, I have a lot of missing values,
FDate Price
11/1/2006 6.28
11/2/2006 6.58
11/3/2006 6.586
11/4/2006 6.716
11/5/2006 NA
11/6/2006 NA
11/7/2006 6.262
11/8/2006 6.27
11/9/2006 6.696
11/10/2006 6.729
11/11/2006 6.487
11/12/2006 NA
11/13/2006 NA
11/14/2006 6.725
11/15/2006 6.844
11/16/2006 6.907
What I would like to do is to fill the NAs with the price from the
previous date * gas used during holidays is purchased from the week
before. Though real simple, I wonder if there is a function to perform
this task. Some of the imputation functions I'm aware of (eg. impute,
transcan in Hmisc) seem to deal with completely different problems.
2.5.0/Windows XP
Thanks in advance.
HT
More information about the R-help
mailing list