# How to simulate with given probability?

I have a presumably simple question. What does this mean: with probability 0.3 variable X is simulated as

X~N(0,1).

How can I simulate X using this?

• What happens if the N(0,1) does not happen? A deterministic zero? Feb 20, 2013 at 14:26
• Simulate... what? The 1s and 0s that might make up X? Feb 20, 2013 at 14:31
• Well thank you both for your interest! Below richard gave exactly the point i couldnt grt. Thank you. Feb 20, 2013 at 15:12
• It sounds like the analyst only has a 30% chance of being at work today. :-) More seriously, the phrase is nonsensical because it is silent about what happens the other 70% of the time--and by its construction it (bizarrely) suggests the possibility that 70% of the time a the variable won't be simulated at all!
– whuber
Feb 21, 2013 at 8:55
• Well the exact phrase is: simulated data were generated as follows. With prob '0.3 X~N(0,1)' and with prob '0.7 X~N(y,1)' (while y is known). Feb 22, 2013 at 11:52

What about first sampling a uniform $U$. If $U<0.3$ (this has probability $0.3$) then you sample $N(0,1)$ else you do something else.