Transition Probability is given as
e.g., for one product, when the current price is High, the probability of next period being High Price is 0.3, and being Low price is 0.7.
My question is that for two independent products, what is the transition probability?
I'm looking for some results like the following table:
e.g., given the current price level is H for product 1 and H for product 2, the probability of being L for 1 and H for 2 is 0.7*0.3 = 0.21.
The current code that I am using is the following:
from sklearn.utils.extmath import cartesian
pr = np.array([[0.3,0.7],[0.6,0.4]])
P = np.zeros((4,4))
count = 0
for i in range(2):
for j in range(2):
P[count] = cartesian((pr[i],pr[j])).prod(1)
count += 1
P
It works well for two products, but for more products it would be very confusing. e.g. For four independent products, the transition matrix is 16*16: for each current state (e.g. HHHH), there are 16 possible future states, e.g. (HHHH, HHHL, HHLH, HHLL, HLHH, .... etc)
Is there an easy and clear way to do this?