Hi there
I am struggling to write programs for forecast combinations. The built-in function 'forecast averaging' only considers one combination, which is to combine all of the individual forecasts. I need to consider all possible combinations of the individual forecasts. For example, if there are 9 individual forecasts, any possible 8, 7, ..., 2 combinations require looking at, ending with 502 possible combinations in total. And the corresponding weights need to be worked out using different weighting schemes. Have you got any insights to write such programs? I am a beginner in programming and am highly appreciated if you can provide any solutions or suggestions.
Many thanks
programs for forecast combination
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- EViews Developer
- Posts: 563
- Joined: Thu Apr 25, 2013 7:48 pm
Re: programs for forecast combination
Hello,
One of the core sub-problems you have is generating all combinations of a certain size. Here's an example EViews program that generates such combinations, storing them as indices in a vector. Since you're generating combinations of multiple sizes, you can surround the relevant code in another loop to iterate through the sizes.
One of the core sub-problems you have is generating all combinations of a certain size. Here's an example EViews program that generates such combinations, storing them as indices in a vector. Since you're generating combinations of multiple sizes, you can surround the relevant code in another loop to iterate through the sizes.
Code: Select all
logmode +l
create u 1
' Parameters for the combination, modeled after n-choose-k, C(n, k).
!n = 5
!k = 3
' Initialize the first combination.
vector(!k) combination
for !i = 1 to !k
combination(!i) = !i
next
while combination(!k) < !n + 1
' Do your work evaluating the combination.
' As an example, we'll just display the indices that represent the combination.
for !i = 1 to !k
%tmp = @str(combination(!i))
logmsg %tmp
next
logmsg "---"
' Advance to the next combination
!j = !k
while !j > 1 and combination(!j) = !j + !n - !k
!j = !j - 1
wend
!s = combination(!j) + 1
for !i = !j to !k
combination(!i) = !s
!s = !s + 1
next
wend
Re: programs for forecast combination
Hi Matt
Thank you very much for your reply!
My work does need to evaluate the forecasting performance, which is to get the percentage of the superior combinations. I will study the code you provide first, and think about the follow-on work afterwards.
Many thanks!
Thank you very much for your reply!
My work does need to evaluate the forecasting performance, which is to get the percentage of the superior combinations. I will study the code you provide first, and think about the follow-on work afterwards.
Many thanks!
Who is online
Users browsing this forum: No registered users and 27 guests