calculation of the first term in the product in the likelihood L(Y | K)
prod_1_init = 1
prod_2_init = 1
prod_init_k = 0
for(n in 1:(2^K)){
prod_1_init = prod_1_init*(gamma(count_init_k[n]+alpha_init_k[n])
/gamma(alpha_init_k[n]))}
prod_2_init = 1
sumalphacount = sum(alpha_init_k+count_init_k)
sumalpha = sum(alpha_init_k)
```
14 Air Pollution

##############

for(i in 1:(dias-1)){ for(j in 1:anos){

for(i in 1:(dias-1)){ for(j in 1:2){

alpha\_1\_k1[i,1] = 7

}

count\_0\_k1 <- matrix(0, dias-1, 2) count\_1\_k1 <- matrix(0, dias-1, 2)

{count\_0\_k1[i,1] = count\_0\_k1[i,1] + 1}

{count\_0\_k1[i,2] = count\_0\_k1[i,2] + 1}

{count\_1\_k1[i,1] = count\_1\_k1[i,1] + 1}

alpha\_0\_k1 <- matrix(0, dias-1, 2) alpha\_1\_k1 <- matrix(0, dias-1, 2)

{count\_1\_k1[i,2] = count\_1\_k1[i,2] + 1}}} # assigning the values of the values of alpha

if(count\_0\_k1[i,j] == 0){alpha\_0\_k1[i,j] = 3} if(count\_1\_k1[i,j] == 0){alpha\_1\_k1[i,j] = 3} }

if(alpha\_0\_k1[i,2] == 0){alpha\_0\_k1[i,2] = 5} }

if(alpha\_1\_k1[i,2] == 0){alpha\_1\_k1[i,2] = 5} }

if(alpha\_0\_k1[i,2] == 0){alpha\_0\_k1[i,2] = 7} }

if(alpha\_1\_k1[i,2] == 0){alpha\_1\_k1[i,2] = 7} }

if(alpha\_0\_k1[i,1] == 0){alpha\_0\_k1[i,1] = 4} if(alpha\_0\_k1[i,2] == 0){alpha\_0\_k1[i,2] = 8} }

if(alpha\_1\_k1[i,1] == 0){alpha\_1\_k1[i,1] = 4} if(alpha\_1\_k1[i,2] == 0){alpha\_1\_k1[i,2] = 8} }

if(alpha\_0\_k1[i,2] == 0){alpha\_0\_k1[i,2] = 8} }

if(alpha\_1\_k1[i,2] == 0){alpha\_1\_k1[i,2] = 8} }

if(alpha\_0\_k1[i,1] == 0){alpha\_0\_k1[i,1] = 8} if(alpha\_0\_k1[i,2] == 0){alpha\_0\_k1[i,2] = 4} }

if(alpha\_1\_k1[i,1] == 0){alpha\_1\_k1[i,1] = 8} if(alpha\_1\_k1[i,2] == 0){alpha\_1\_k1[i,2] = 4} }

if(alpha\_0\_k1[i,1] == 0){alpha\_0\_k1[i,1] = 8} }

if(alpha\_1\_k1[i,1] == 0){alpha\_1\_k1[i,1] = 8} }
