Question

Simulates 2 coin toss and calculate emperical probability of getting double heads. # Function tossl() simulates...

Simulates 2 coin toss and calculate emperical probability of getting double heads.
# Function tossl() simulates coin toss
toss <- function(x) floor(2*runif(x))
# Let c1 tosses from coin 1 and c2 represent tosses of coin 2. We’ll store 1000 coin tosses in c1 and c2
c1=toss(1000)
c2=toss(1000)
dheads=sum((c1+c2)==2)
# Double heads dheads will occurs when corresponding sum of outcomes is 2
# == operator is TRUE only when the sum of corresponding tosses is 2 (Two
heads came up)
#sum((c1+c2)==2) then adds up all TRUE events and stores the count in dheads.
#Print the output. Final results with comments should be the only thing
printed out.
cat("Emperical probability of getting double heads is", dheads/1000, ’\n’)

a) what is the final script file and discuss the results of your experiment?

b) Does the emperical proability matches theoretical one?

c) Modify the code so that 3 coins are tossed and calculate emperical probability of triple heads.

Homework Answers

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
An unfair coin is such that on any given toss, the probability of getting heads is...
An unfair coin is such that on any given toss, the probability of getting heads is 0.6 and the probability of getting tails is 0.4. The coin is tossed 8 times. Let the random variable X be the number of times heads is tossed. 1. Find P(X=5). 2. Find P(X≥3). 3. What is the expected value for this random variable? E(X) = 4. What is the standard deviation for this random variable? (Give your answer to 3 decimal places) SD(X)...
We toss n coins and each one shows up heads with probability p, independent of the...
We toss n coins and each one shows up heads with probability p, independent of the other coin tosses. Each coin which shows up heads is tossed again. What is the probability mass function of the number of heads obtained after the second round of coin tossing?
A biased coin is tossed repeatedly. The probability of getting head in any particular toss is...
A biased coin is tossed repeatedly. The probability of getting head in any particular toss is 0.3.Assuming that the tosses are independent, find the probability that 3rd head appears exactly at the 10th toss.
A fair coin is tossed 4 times. What is the probability of getting exactly 3 heads...
A fair coin is tossed 4 times. What is the probability of getting exactly 3 heads conditioned on the event that the first two tosses came out the same?
coin 1 has probability 0.7 of coming up heads, and coin 2 has probability of 0.6...
coin 1 has probability 0.7 of coming up heads, and coin 2 has probability of 0.6 of coming up heads. we flip a coin each day. if the coin flipped today comes up head, then we select coin 1 to flip tomorrow, and if it comes up tail, then we select coin 2 to flip tomorrow. find the following: a) the transition probability matrix P b) in a long run, what percentage of the results are heads? c) if the...
(a) Use the central limit theorem to determine the probability that if you toss a coin...
(a) Use the central limit theorem to determine the probability that if you toss a coin 50 times, you get fewer than 20 heads. (b) A coin is continuously tossed until the heads come up 20th time. Use the central limit theorem to estimate the probability that more than 50 coin tosses are required to get the 20th head. (c) Compare your answers from parts (a) and (b). Why are they close but not exactly equal?
Suppose you toss an unfair coin 8 times independently. The probability of getting heads is 0.3....
Suppose you toss an unfair coin 8 times independently. The probability of getting heads is 0.3. Denote the outcome to be 1 if you get heads and 0 if you get tails. 1.Write down the sample space. 2. What is the probability of the event that you get a head or a tail at least once? 3. If you get 8 same toss you will get x dollars, otherwise you will lose one dollar. On average, how large should x...
The theoretical probability of a coin landing heads up is 1/2 Does this probability mean that...
The theoretical probability of a coin landing heads up is 1/2 Does this probability mean that if a coin is flipped two​ times, one flip will land heads​ up? If​ not, what does it​ mean? Choose the correct answer below. A. ​Yes, it means that if a coin was flipped two​ times, at least one of the tosses would land heads up. B. ​Yes, it means that if a coin was flipped two​ times, exactly one of the tosses would...
Let p denote the probability that a particular coin will show heads when randomly tossed. It...
Let p denote the probability that a particular coin will show heads when randomly tossed. It is not necessarily true that the coin is a “fair” coin wherein p=1/2. Find the a posteriori probability density function f(p|TN ) where TN is the observed number of heads n observed in N tosses of a coin. The a priori density is p~U[0.2,0.8], i.e., uniform over this interval. Make some plots of the a posteriori density.
Assume p represents the probability that a particular coin will show heads when randomly tossed. Don't...
Assume p represents the probability that a particular coin will show heads when randomly tossed. Don't assume its true that the coin is a “fair” coin wherein p=1/2. Determine the a posteriori probability density function f(p|TN) where TN is the observed number of heads n observed in N tosses of a coin. The a priori density is p~U[0.2,0.8], i.e., uniform over this interval. Create some plots of the a posteriori density.