Hello,
I need your help in programming a problem:
First, there are 15 groups called _modelo {! M}, where m ranges from 2 to 16. These groups each contain 84 columns and 1025 rows. (None null)
Second, there is an additional group called _stocksku that has 84 columns and 1025 rows, but only have values up to row 114, the other rows are all null.
What I need is to do a program that generates m matrices named for example _matrix {! M}, with m from 2 to 16. The matrices must be 84 columns and 97 rows.
The values within the m matrices must be the division between _stocksku on model {! M} where m varies for each generated matrix. The particularity is that the values should correspond as follows:
-> For the _stocksku group we must consider data from 1 to 97
-> For each group _modelo {! M} we must consider from 912 to 1008
The relationship between _stocksku and each _model {! M} should look like this:
1 912
2 913
3 914
. .
. .
. .
96 1007
97 1008
This is the program that generates the groups:[code][/code]
smpl @all
matrix(@obsrange, 84) _dias_piso
for !j = 1 to 84
for !i = 1 to @obsrange
%demanda_acum = @str(!i) + " " + @str(@obsrange)
series pisos = @cumsum(demandasku{!j}, %demanda_acum) <= @elem(stocksku{!j}, !i)
_dias_piso(!i, !j) = @sum(pisos)
next
next
for !j= 2 to 6
for !i =1 to 84
group _SKU
_SKU.add sku{!i}
group _STOCKSKU
_STOCKSKU.add STOCKSKU{!i}
for !k=7 to 12
group _Modelo{!k}
equation Reg_Simple_eq_sku{!i}.ls sku{!i} c corr
forecast sku{!i}_7
equation Reg_Simple_eq_sku{!i}.ls sku{!i} c corr corr^2
forecast sku{!i}_8
equation AR1_eq_sku{!i}.ls sku{!i} c corr sku{!i}(-1)
forecast sku{!i}_9
equation AR2_eq_sku{!i}.ls sku{!i} c corr sku{!i}(-1) sku{!i}(-2)
forecast sku{!i}_10
equation AR3_eq_sku{!i}.ls sku{!i} c corr sku{!i}(-1) sku{!i}(-2) sku{!i}(-3)
forecast sku{!i}_11
equation Salida_eq_sku{!i}.ls sku{!i} c salida_del_mes mes lunes martes miercoles jueves viernes
forecast sku{!i}_12
_Modelo{!k}.add sku{!i}_{!k}
next
group _Modelo{!j}
series Moving_Average_{!j}sku{!i} =( @movsum(sku{!i}, {!j}) ) / {!j}
_Modelo{!j}.add Moving_Average_{!j}sku{!i}
for !l=13 to 16
group _Modelo{!l}
smooth(s) sku{!i} SE13_sku{!i} [4]
smooth(d) sku{!i} SE14_sku{!i} [4]
smooth(n) sku{!i} SE15_sku{!i} [4]
smooth(a) sku{!i} SE16_sku{!i} [4]
_Modelo{!l}.add SE{!l}_sku{!i}
next
next
next
Thanks very much in advance,
Generation of matrices with particularity in the observations
Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt
-
- Posts: 24
- Joined: Tue Jun 13, 2017 12:04 pm
Generation of matrices with particularity in the observations
- Attachments
-
- Para el foro.WF1
- (14.3 MiB) Downloaded 206 times
-
- EViews Developer
- Posts: 562
- Joined: Thu Apr 25, 2013 7:48 pm
Re: Generation of matrices with particularity in the observations
Hello,
It sounds like you could use a few loops to go through all the elements:
It sounds like you could use a few loops to go through all the elements:
Code: Select all
for !m = 2 to 16
matrix(97, 84) _matrix!m
for !c = 1 to 84
for !r = 1 to 97
_matrix!m(!r, !c) = _stocksku(!c)(!r) / _modelo!m(!c)(!r + 911)
next
next
next
-
- Posts: 24
- Joined: Tue Jun 13, 2017 12:04 pm
Re: Generation of matrices with particularity in the observations
EViews Matt wrote:Hello,
It sounds like you could use a few loops to go through all the elements:Code: Select all
for !m = 2 to 16
matrix(97, 84) _matrix!m
for !c = 1 to 84
for !r = 1 to 97
_matrix!m(!r, !c) = _stocksku(!c)(!r) / _modelo!m(!c)(!r + 911)
next
next
next
It works perfect
Who is online
Users browsing this forum: No registered users and 13 guests