Hello,

I am having trouble figuring out the correct commands when I try to compare the seasonal naive method with Holt-Winters' additive seasonal exponential smoothing method using time series cross-validation. I have 280 observations of two variables: t = quarterly time (i.e. 2001q1, 2001q2, 2001q3, 2001q4, etc.) and v90 which are random numbers. I'm trying to make one year ahead forecast of v90 and I'm to use all except the last two years of data for my first training set. I'll then use MAE to measure the forecast performance. Lastly, the number of iterations needs to be limited to 15.

Here are the commands I have entered so far, and although they run, it doesn't seem right. (Stata/IC 16.1)

gen f_add = .
gen f_nai = .
forvalues e = 272/276 {
noi di "`e'"
tssmooth shwinters tmp1 = v90 in 1/`e', replace iter(15) forecast(4) add
replace f_add = tmp1 in `=`e'+4'
replace f_nai = l4.v31 in -5/l
}

drop tmp1

gen abserr_fss = abs(v90-f_add)
gen abserr_fsn = abs(v90-f_nai)

noi su abserr*

Any kind of help would be greatly appreciated. Thanks.