sagarnikam123
2012-May-19 12:23 UTC
[R] how to predict/forecast missing values in time series ?
i have time series as
1.3578511
0.5119648
1.3189847
0.9214787
1.2272616
4.9167998
1.2272616
1.2272616
0.8854192
2.3386331
1.6132899
0.2030302
0.8426226
1.2277843
NA
1.3189847
1.3578511
0.8530141
2.3386331
1.0541099
0.7747481
0.5764672
1.3189847
1.2160533
1.2272616
0.6715839
0.9651803
1.6132899
1.2006974
0.6875047
1.3245534
1.2006974
0.8221709
1.3101684
1.6132899
1.6132899
1.2006974
1.3189847
1.0018480
1.2277843
1.4424190
1.6132899
1.2277843
1.2006974
0.7779642
0.9381081
0.8854192
NA
NA
1.3189847
1.1070461
0.8221709
4.9167998
0.9214787
1.3189847
1.3189847
1.2277843
1.4424190
1.6132899
1.6132899
4.9167998
0.8235792
0.9708839
1.1070461
1.2160533
0.8354292
1.4424190
1.1958634
0.5119648
1.4424190
1.4424190
1.6132899
1.6132899
0.6710844
1.2272616
0.9708839
0.8890464
1.4424190
0.8890464
0.8221709
1.1958634
0.8132233
0.4630722
4.9167998
0.8890464
1.3189847
0.7373181
1.1070461
1.2279813
0.8890464
0.3588158
1.4424190
0.8132233
0.4297043
1.3578511
4.9167998
1.2272616
0.8426226
1.4424190
1.6132899
NA
in which NA are missing values,i want to predict/forecast it,i search on
internet,i found that Amelia packages can impute missing values;
i used but it giving error,how can i resolve it
library(Amelia)
t<-read.table("C:\\Users\\exam\\Desktop\\missing_ts.txt")
> a.out <- amelia(t)
Amelia Error Code: 42
There is only 1 column of data. Cannot impute
> amelia(x=as.matrix(1:101,t$V1))
Amelia Error Code: 39
Your data has no missing values. Make sure the code for
missing data is set to the code for R, which is NA
> amelia(t$V1)
Error in colSums(!is.na(x)) :
'x' must be an array of at least two dimensions
is my way of predicting wrong?,if yes,then which method should i follow?
--
View this message in context:
http://r.789695.n4.nabble.com/how-to-predict-forecast-missing-values-in-time-series-tp4630588.html
Sent from the R help mailing list archive at Nabble.com.
Jeff Newmiller
2012-May-19 15:09 UTC
[R] how to predict/forecast missing values in time series ?
library (zoo)
?na.approx
Note that you need to define an index (time base) to go along with your data,
but that could be as simple as a sequence of integers.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live
Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
sagarnikam123 <sagarnikam123 at gmail.com> wrote:
>i have time series as
>1.3578511
>0.5119648
>1.3189847
>0.9214787
>1.2272616
>4.9167998
>1.2272616
>1.2272616
>0.8854192
>2.3386331
>1.6132899
>0.2030302
>0.8426226
>1.2277843
>NA
>1.3189847
>1.3578511
>0.8530141
>2.3386331
>1.0541099
>0.7747481
>0.5764672
>1.3189847
>1.2160533
>1.2272616
>0.6715839
>0.9651803
>1.6132899
>1.2006974
>0.6875047
>1.3245534
>1.2006974
>0.8221709
>1.3101684
>1.6132899
>1.6132899
>1.2006974
>1.3189847
>1.0018480
>1.2277843
>1.4424190
>1.6132899
>1.2277843
>1.2006974
>0.7779642
>0.9381081
>0.8854192
>NA
>NA
>1.3189847
>1.1070461
>0.8221709
>4.9167998
>0.9214787
>1.3189847
>1.3189847
>1.2277843
>1.4424190
>1.6132899
>1.6132899
>4.9167998
>0.8235792
>0.9708839
>1.1070461
>1.2160533
>0.8354292
>1.4424190
>1.1958634
>0.5119648
>1.4424190
>1.4424190
>1.6132899
>1.6132899
>0.6710844
>1.2272616
>0.9708839
>0.8890464
>1.4424190
>0.8890464
>0.8221709
>1.1958634
>0.8132233
>0.4630722
>4.9167998
>0.8890464
>1.3189847
>0.7373181
>1.1070461
>1.2279813
>0.8890464
>0.3588158
>1.4424190
>0.8132233
>0.4297043
>1.3578511
>4.9167998
>1.2272616
>0.8426226
>1.4424190
>1.6132899
>NA
>
>
>in which NA are missing values,i want to predict/forecast it,i search
>on
>internet,i found that Amelia packages can impute missing values;
>i used but it giving error,how can i resolve it
>
>library(Amelia)
>t<-read.table("C:\\Users\\exam\\Desktop\\missing_ts.txt")
>
>> a.out <- amelia(t)
>Amelia Error Code: 42
>There is only 1 column of data. Cannot impute
>
>> amelia(x=as.matrix(1:101,t$V1))
>Amelia Error Code: 39
>Your data has no missing values. Make sure the code for
>missing data is set to the code for R, which is NA
>
>> amelia(t$V1)
>Error in colSums(!is.na(x)) :
> 'x' must be an array of at least two dimensions
>
>is my way of predicting wrong?,if yes,then which method should i
>follow?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/how-to-predict-forecast-missing-values-in-time-series-tp4630588.html
>Sent from the R help mailing list archive at Nabble.com.
>
>______________________________________________
>R-help at 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.
Gabor Grothendieck
2012-May-19 15:14 UTC
[R] how to predict/forecast missing values in time series ?
On Sat, May 19, 2012 at 11:09 AM, Jeff Newmiller <jdnewmil at dcn.davis.ca.us> wrote:> library (zoo) > ?na.approx > > Note that you need to define an index (time base) to go along with your data, but that could be as simple as a sequence of integers.Actually na.approx in the zoo package has a default method that works with plain vectors too. -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com