How naive forecast is used on validation and test sets? I need to understand how naive method works when it comes to validation and test sets. I created the following time series and the data partition is as follows: the first 20 days as train, the next 5 days as validation set, and the last 5 days as test.
I want to understand the logic behind it, so I do not want to use any library to do it.
day<- seq(1,30,1)
set.seed(7)
Gas <- round(runif(30,4,7), 1)
df=data.frame(cbind(day,Gas))


Naive forecast means that you take the last observation as your prediction. So if the first 20 days are your train set, you would always predict the 20th day value from the train set as your forecast.
