Yearly Forecast: 2010 Analysis

Data Analysis

This report processes the historical data from 1995 to 2009 to generate a monthly forecast for the year 2010.

```{r}

#| label: load-data #| message: false #| warning: false

library(forecast) library(ggplot2) library(knitr)

Historical data input (Values from your image)

values <- c(1463.9, 1373.3, 1533.7, 1420.6, 1576.3, 1607.5, 1545.7, 1550.8, 1583.0, 1622.6, 1705.5, 2212.4, 1580.7, 1485.5, 1582.6, 1498.9, 1644.5, 1610.9, 1695.0, 1664.9, 1583.8, 1740.4, 1798.7, 2296.1,1686.0, 1576.9, 1608.8, 1610.8, 1712.9, 1664.3, 1698.0, 1662.9, 1678.9, 1811.1, 1835.5, 2418.4,1724.9, 1531.3, 1660.0, 1602.0, 1677.0, 1668.8, 1699.6, 1649.9, 1685.0, 1783.6, 1776.0, 2323.2,1775.4, 1597.2, 1733.6, 1681.0, 1764.5, 1779.0, 1817.4, 1830.7, 1894.3, 2000.7, 2037.0, 2568.3,1924.7, 1813.6, 1919.9, 1769.8, 1985.7, 2346.3, 1875.7, 2013.1, 2015.7, 2098.2, 2213.3, 2776.0,2095.8, 1887.4, 2063.2, 1982.7, 2118.3, 2205.1, 2217.5, 2253.1, 2188.7, 2404.9, 2517.4, 3113.9,2438.8, 2123.9, 2296.4, 2336.0, 2478.6, 2475.0, 2465.3, 2501.2, 2460.6, 2635.3, 2752.9, 3366.1, 2528.5, 2231.8, 2430.7, 2368.9, 2539.9, 2595.6, 2675.1, 2665.2, 2726.7, 2903.8, 2948.3, 3650.5,2829.9, 2545.4, 2746.3, 2569.2, 2675.2, 2793.8, 2843.3, 2798.1, 2848.0, 3078.3, 3185.1, 3877.3, 2963.1, 2622.9, 2782.9, 2787.4, 2879.3, 2969.3, 2964.4, 2984.4, 2971.0, 3099.2, 3252.9, 4088.1,3036.0, 2692.5, 2953.4, 2804.1, 3026.2, 3148.2, 3120.4, 3150.1, 3196.1, 3346.8, 3494.0, 4301.3,3332.3, 2963.4, 3283.3, 3010.1, 3239.8, 3399.0, 3333.5, 3433.6, 3443.2, 3591.4, 3774.4, 4684.7,3535.1, 3142.9, 3212.5, 3238.4, 3349.2, 3443.7, 3413.8, 3411.0, 3327.8, 3530.5, 3595.6, 4908.6,3560.7, 2968.2, 3301.6, 3203.9, 3379.7, 3620.6, 3452.3, 3467.7, 3406.1, 3641.3, 3787.3, 4707.5) # Creating Time Series object data_ts <- ts(values, start = c(1995, 1), frequency = 12)`` #| label: forecast-2010 fit <- ets(data_ts) f_2010 <- forecast(fit, h = 12) # Create a clean table for the output months <- month.name forecast_table <- data.frame(Month = months, Forecast_Value = round(as.numeric(f_2010$mean), 1)) kable(forecast_table, caption = “Predicted Values for 2010”) #| label: plot #| echo: false autoplot(f_2010) + labs(title = “Historical Data and 2010 Forecast”, x = “Year”, y = “Value”) + theme_minimal() install.packages(c(“forecast”, “ggplot2”, “knitr”)) 31b8e172-b470-440e-83d8-e6b185028602:dAB5AHAAZQA6AFoAUQBBAHgAQQBEAGcAQQBNAFEAQQA1AEEARABZAEEATQBBAEEAMQBBAEMAMABBAE0AQQBCAGgAQQBHAE0AQQBaAEEAQQB0AEEARABRAEEAWgBnAEIAaABBAEcAVQBBAEwAUQBBADQAQQBHAEkAQQBPAFEAQQA1AEEAQwAwAEEATwBRAEIAagBBAEQARQBBAFkAZwBBADMAQQBHAEkAQQBaAEEAQQAzAEEARwBNAEEATQBBAEIAbQBBAEQARQBBAAoAcABvAHMAaQB0AGkAbwBuADoATQBnAEEAegBBAEQAawBBAE4AQQBBAD0ACgBwAHIAZQBmAGkAeAA6AAoAcwBvAHUAcgBjAGUAOgBMAFEAQQB0AEEAQwAwAEEAQwBnAEIAMABBAEcAawBBAGQAQQBCAHMAQQBHAFUAQQBPAGcAQQBnAEEAQwBJAEEAVABRAEIAdgBBAEcANABBAGQAQQBCAG8AQQBHAHcAQQBlAFEAQQBnAEEARQBZAEEAYgB3AEIAeQBBAEcAVQBBAFkAdwBCAGgAQQBIAE0AQQBkAEEAQQBnAEEARwBZAEEAYgB3AEIAeQBBAEMAQQBBAE0AZwBBAHcAQQBEAEUAQQBNAEEAQQBpAEEAQQBvAEEAWgBnAEIAdgBBAEgASQBBAGIAUQBCAGgAQQBIAFEAQQBPAGcAQQBnAEEARwBnAEEAZABBAEIAdABBAEcAdwBBAEMAZwBBAHQAQQBDADAAQQBMAFEAQQA9AAoAcwB1AGYAZgBpAHgAOgA=:31b8e172-b470-440e-83d8-e6b185028602 ```{r} #| label: setup #| include: false # This block checks if you have the packages and installs them if you don’t if (!require(“forecast”)) install.packages(“forecast”) if (!require(“ggplot2”)) install.packages(“ggplot2”) if (!require(“knitr”)) install.packages(“knitr”) library(forecast) library(ggplot2) library(knitr) #| label: plot-forecast #| echo: false autoplot(f) + theme_minimal() + labs(y = “Value”, x = “Year”) #| label: forecast-model # Fit ETS model fit <- ets(data_ts) # Forecast for the next 12 months (year 2010) forecast_2010 <- forecast(fit, h = 12) # Display the forecast values print(forecast_2010) #| label: plot-forecast autoplot(forecast_2010) labs(title = “Monthly Forecast for 2010”, subtitle = “Based on Historical Data (1995-2009)”, y = “Value”, x = “Year”) + theme_minimal()