Hi Everyone,
I have 13 events, and I want to have a probability for each.
- Define the Partial_Sum(j)=sum(p(k) to p(j)), where j=1,2,...13 with Partial_Sum(14)=1
- To sample from this discrete distribution, a random variable X is drawn from a continuous uniform distribution on the interval (0,1)
- For each value of j check which of the following N mutual events is true:
* X<=Partial_Sum(1)
* Partial_Sum(j-1)<X<=Partial_Sum(j) for j=2,3,...,13
I need to write a code for this. Could you please help me with this?
I have 13 events, and I want to have a probability for each.
- Define the Partial_Sum(j)=sum(p(k) to p(j)), where j=1,2,...13 with Partial_Sum(14)=1
- To sample from this discrete distribution, a random variable X is drawn from a continuous uniform distribution on the interval (0,1)
- For each value of j check which of the following N mutual events is true:
* X<=Partial_Sum(1)
* Partial_Sum(j-1)<X<=Partial_Sum(j) for j=2,3,...,13
I need to write a code for this. Could you please help me with this?
Comment