how to random sample proportional to probabilities I have a ten-sided die, where I know the probabilities of rolling some, but not all of the values on the die:
value   probability
three   0.173
four    0.062
seven   0.019
nine    0.322

How can I generate a random sample of these four values proportional to each values' probability?
 A: Conditional on the value being one of those four, you generate from those four by scaling their unconditional probabilities by the sum of their probabilities (0.576).
This gives the conditional probabilities (rounded to 3dp):
value   probability
three   0.300
four    0.108
seven   0.033
nine    0.559

You can simulate from those probabilities by a variety of methods, such as the inverse cdf method. In that case cumulate the probabilities:
        cumulative
value   probability
three   0.300
four    0.408
seven   0.442
nine    1.000

Then generate a standard uniform variate. If it's $\leq$ 0.3, the result is "three", if it's > 0.3 but $\leq$ 0.408, the result is "four" and so on.
There are more efficient methods, but this is often sufficient.
Many packages make this job easier. In R one can simply use sample:
sample(c("three","four","seven","nine"),size=20,p=c(.173,.062,.019,.322),replace=TRUE)
 [1] "three" "three" "nine"  "nine"  "three" "nine"  "nine"  "nine"  "nine" 
[10] "three" "three" "nine"  "three" "nine"  "nine"  "nine"  "four"  "three"
[19] "nine"  "four" 

It helpfully scales the probabilities automatically. We can as easily tabulate the results (now sampling 200 rolls instead of 20):
> table(sample(c("three","four","seven","nine"),
                 size=200,p=c(.173,.062,.019,.322),replace=TRUE))

 four  nine seven three 
   19   115    10    56 

