calculation of the transition probabilities m -> 0 and m -> 1
for(m in 1:2^K){
for(i in 1:dd){
p_m0[i,m] = (alpha_m0[i,m] + n_m0[i,m] - 1)/((alpha_m1[i,m] + n_m1[i,m] - 1)
+(alpha_m0[i,m] + n_m0[i,m] - 1))
p_m1[i,m] = (alpha_m1[i,m] + n_m1[i,m] - 1)/((alpha_m1[i,m] + n_m1[i,m] - 1)
+(alpha_m0[i,m] + n_m0[i,m] - 1)) }}
trans_mat <- matrix(0, 2^K, dd)
for(m in 1:2^K){
for(i in 1:dd){
trans_mat[m,i] = p_m0[i,m]}}
write.csv(trans_mat, file = "trans_mat.txt")
```
16 Air Pollution

limsup = sum(alpha\_init\_k+count\_init\_k) - sum(alpha\_init\_k)

mbase <- matrix(0, dias - K, anos) # that is overline{m}

mbase[i,j] = mbase[i,j] + ozonio\_sw[i+l,j]\*2^l}

if(mbase[i,j] == n){s[i,n+1] = s[i, n+1] + 1} }

prod\_init\_k = prod\_1\_init\*prod\_2\_init term\_init\_like[K+1] = prod\_init\_k

s <- matrix(0, (dias-K), 2^K)
