How to impute missing values in Time series by Moving Average in R

r
time_series

#1

I am trying to impute the missing values in a time series by moving average method in R.

Attached the slides that I could find in the web regarding this topic.

I am new to R and have no clue where to start with. Any help would be much appreciated!

Thanks
Krishna

New folder.zip (246.9 KB)


#2

@krishnamreddy- Sorry I am unable to download the slides.But if you need any help regarding moving average method in R.

http://www.inside-r.org/packages/cran/TTR/docs/GD

It is very good examples .

Hope this helps!

Regards,
Hinduja


#3

Sorry also unable to open the slides…

But doing this in R is really simple.

You can use this package:
https://cran.r-project.org/web/packages/imputeTS/index.html

Install it with: install.packages(“imputeTS”)
Load it: library(imputeTS)

And then it has a function called:

na.ma(x, k = 4, weighting = “exponential”)

Where x would be your time series, k is the window size and with weighting you can choose between simple,linear, exponentially weighted moving average,