# Naive Approach Forecasting Example

Naive approach forecasting example, A naïve forecast is one in which the forecast for a particular period is just the same as the preceding period’s value.

For example, you sold 250 computers last month and estimate that you would sell 250 computers again this month.

The naive approach takes into account what happened in the preceding period and forecasts that it will happen again.

## Naive approach forecasting example

Despite its simplicity, this strategy works remarkably effectively in practice.

This article shows you how to do naive forecasting in R with step-by-step instructions.

### Step 1: Enter the Information

To begin, we’ll enter sales data for a fictional corporation during a 12-month period.

Make a vector to hold real-world sales data

actual <- c(31, 35, 36, 33, 32, 31, 36, 35, 34, 32, 31, 32)

### Step 2: Generate the Naive Forecasts

Then, for each month, we’ll make naive projections using the algorithms below.

forecast <- c(NA, actual[-length(actual)])

Let’s view the naive forecasts

forecast

NA 31 35 36 33 32 31 36 35 34 32 31

Note that for the first anticipated value, we just used NA.

### Step 3: Assess the Predictions’ Accuracy

Finally, we must assess the forecasts’ precision. The following are two popular accuracy metrics:

The absolute percentage error in the mean (MAPE)

#### Absolute Mean Error (MAE)

To calculate both metrics, we may use the following code:

MAPE should be calculated.

mean(abs((actual-forecast)/actual), na.rm=T) * 100 5.630553

Now we can calculate MAE

mean(abs(actual-forecast), na.rm=T) 1.909091

The average absolute percentage inaccuracy is 5.6 percent, with an average absolute error of 1.9 percent.

We may compare this forecast to other forecasting models to check if the accuracy measurements are better or worse to see whether it is useful.

**Step 4: Visualization**

Finally, we can display the discrepancies between actual sales and naive sales projections for each period using a simple line plot:

Now let’s plot actual sales

plot(actual, type='l', col = 'red', main='Actual vs. Forecasted', xlab='Sales Period', ylab='Sales') lines(forecast, type='l', col = 'blue') legend('topright', legend=c('Actual', 'Forecasted'), col=c('red', 'blue'), lty=1)

It’s important to note that the anticipated sales line is essentially a delayed version of the line of the actual sale.

Because the naive prediction just anticipates the current period’s sales to be equal to the prior period’s sales, this is exactly what we would expect the plot to look like.