Question

Take a simple random sample from a box of 100000 tickets, the box contains 50% 0's...

Take a simple random sample from a box of 100000 tickets, the box contains 50% 0's and 50% 1's. If you draw 2500 and 25000 tickets respectively without replacement, using R studio, do 10000 replications for each part, and find the SD of all the sample percent. Moreover, make a histogram of the 10000 sample percent for each part (2 histograms).

Homework Answers

Answer #1

R CODE:

n=100000
x=c()
S1=c()
S2=c()

for(k in 1:10000)
{
   #creating the box of 100000 tickets
   x=sample(c(0,1),size=n,replace=TRUE)
  
   #drawing sample of size 2500 without replacement
   A=sample(x,size=2500,replace=FALSE)
   #taking sum
   S1[k]=sum(A)

   #drawing sample of size 25000 without replacement
   B=sample(x,size=25000,replace=FALSE)
   #taking sum
   S2[k]=sum(B)
  
}
sd(S1)
sd(S2)
par(mfrow=c(1,2))
hist(S1,main="Histogram(2500)")
hist(S2,main="Histogram(25000)")


RESULT:

> sd(S1)
[1] 24.81566
> sd(S2)
[1] 79.15947

GRAPH:

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
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT