** Question 1: Naive Forecasting

Project Objective

To investigate the MSE, MAE, MAPE, and to forecast week 7 value.

Question 1: Use normal method to find MSE, MAE, MAPE, and predict week 7 sales.

Step 1: Create data frame.

week <- 1:6 # Independent Variable
value <- c(17,13,15,11,17,14) # Dependent Variable

Step 2: Calculate MSE

forecast <- value[-length(value)] # Excludes last sale
actual <- value[-1] # Excludes the first sale
mse <- mean((actual - forecast)^2)
mse # Mean square error is 16.20a
## [1] 16.2

Step 3: Forecast week 7

forecast_week7 <- tail(value, 1)
forecast_week7
## [1] 14

Question 2: Calculate Cumulative Average value?

cumulative_averages <- cumsum(value[-length(value)]) / (1:(length(value)-1))
cumulative_averages
## [1] 17.0 15.0 15.0 14.0 14.6
forecast_b <- cumulative_averages
actual_b <- value[-1]
mse_b <- mean((actual_b - forecast_b)^2)
mse_b
## [1] 8.272

Question 2: What is the Forecast in Week 7?

forecast_week7_b <- mean(value)
forecast_week7_b
## [1] 14.5

Question 3: What is MAE?

residuals_b <- actual_b - forecast_b
mae_b <- mean(residuals_b)
mae_b
## [1] -1.12

Question 4: What is MAPE?

percentage_error_2 <- abs(residuals_b / actual_b) * 100
mape_b <- mean(percentage_error_2)
mape_b
## [1] 17.81313
Interpretation: mape_b < mape1. We use weighted average error values and prediction.