alpha_m1 is associated to the transitions m -> 1 for each day and each m
alpha_m0 <- matrix(0, (dias - K), 2^K)
alpha_m1 <- matrix(0, (dias - K), 2^K)
for(i in 1:(dias-K)){
for(m in 1:2^K){
if(n_m0[i,m] == 0){alpha_m0[i,m] = 3}
if(n_m1[i,m] == 0){alpha_m1[i,m] = 3}
} #closes the m loop
for(m in 1:2^K){
if((n_m0[i,m] == min(n_m0[i,m], n_m1[i,m])) & (alpha_m0[i,m] == 0)){
alpha_m0[i,m] = 4
if((abs(n_m0[i,m] - n_m1[i,m]) >= 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 7}
if((abs(n_m0[i,m] - n_m1[i,m]) < 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 5}}
if((n_m0[i,m] == min(n_m0[i,m], n_m1[i,m])) & (alpha_m0[i,m] != 0)){
if((abs(n_m0[i,m] - n_m1[i,m]) >= 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 7}
if((abs(n_m0[i,m] - n_m1[i,m]) < 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 5} }
if((n_m0[i,m] == max(n_m0[i,m], n_m1[i,m])) & (alpha_m0[i,m] == 0))
```

```
{ alpha_m0[i,m] = 8
if((abs(n_m0[i,m] - n_m1[i,m]) >= 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 4}
if((abs(n_m0[i,m] - n_m1[i,m]) < 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 7} }
if((n_m0[i,m] == min(n_m0[i,m], n_m1[i,m])) & (alpha_m0[i,m] != 0)){
if((abs(n_m0[i,m] - n_m1[i,m]) >= 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 4}
if((abs(n_m0[i,m] - n_m1[i,m]) < 5) & (alpha_m1[i,m] == 0)){alpha_m1[i,m] = 7} }
} #closes the second m loop
} #closes the i loop