I need to generate X1,X2 and X3 as follows:
- Sample X1 ~ U(0, 1)
- Sample X2 ~ U(0, 1-X1)
- Set X3 = 1- X1- X2.
I am trying to code as:
N = 100
X1 = np.random.rand(N)
X2 = X1 - np.random.rand(N)
X3 = 1-X1-X2
But it's returning -(ve) value for X2. How can I get (+)ve values along according to the condition.
Thanks
Aucun commentaire:
Enregistrer un commentaire