This needs to be done in R. Post the code you employed to produce your results. I posted in Comp Sci also but to no avail.
California has 23.6 million eligible voters. 30% are registered as Republican. Texas has 18.8 million eligible voters. 45% are registered as Republican. Let A be probability of choosing a voter from California. Let B be the probability of selecting a Republican voter.
Using a simulation of 50 voters, find out the following:
a. P(A)
b. P(B)
c. P(B|A)
d. P(AnB)
e. P(A|B)
f. P(A|BC)
Do the above using a simulation of 1000 voters. How close is each of your twelve simulated probabilities to the mathematically computed levels? Explain any patterns you notice.