I am forecasting rainfall of India using holt winters method. Data is from year 2000 to 2015. I am using monthly data.

library(readxl)

require(graphics)

library(forecast)

library(timeSeries)

library (tseries)

library(ggplot2)

library(TTR)

rn <- read.csv("data/karnataka_rain.csv", stringsAsFactors = FALSE)

r <- ts(rn$rain, start = c(2000, 1), end=c(2015,12),frequency = 12)

head(rn$rain)

plot.ts(r, ylab= "rain", xlab= "year")

decomp_rn <- decompose(r)

plot(decomp_rn)

adf.test(r, alternative = "stationary")

forecast_model <- HoltWinters(r)

forecast_model

plot(forecast_model)

forecast_values <- forecast(forecast_model, h = 24,

level = c(0.85,0.95))

forecast_values

plot(forecast_values)