I want to compare probability of an event with a randomly drawn number and then choose an event based on different conditions across various time periods.
for example, my probability matrix for three time periods is;
P =[0.8 0.9 0.2; 0.3 0.6 0.5]
and randomly drawns numbers matrix is
R = [0.6 0.3 0.5; 0.4 0.5 0.7]
then I need to compare each column of R with each column of P, and applya condition like if R is greater than P, event1 will happen otherwise event2 will happen.
The outcome should be
Events = [event2 event2 event1 ; event1 event2 event1]
Finally I need to count for each row how many transitions occur. For example for row 1, event2 occurs twice and event1 occurs once.
Can anyone help me how to start the code for it? or any relevant tip. Many thanks