HW 5

docx

School

Temple University *

*We aren’t endorsed by this school

Course

2521

Subject

Statistics

Date

Jan 9, 2024

Type

docx

Pages

4

Uploaded by DeanStar27858

Report
HW 5 Sam Saporito 1. Toss a fair coin 10 times. Find the probability of getting exactly 5 heads a) using the formula of Binomial pmf; choose(10,5)*.5^5*(1-.5)^(10-5); [1] 0.2460938 b) using Binomial density function dbinom; > dbinom(5,10,.5) [1] 0.2460938 c) using Binomial cumulative probability function pbinom; pbinom(5,10,.5) – pbinom(4,10,.5) [1] 0.2460938 d) using normal approximation. (Hint: first follow page 20 of the slides and check whether normal approximation is appropriate)
Normal distributiuon is appropriate because the graph is symmetrical. 2. a) Generate a random sample with 10 observations from the normal population with mean 5 and variance 25 (NOT standard deviation). Report the sample mean and the sample variance for this sample. # stdv is square root var >n=10 >x=rnorm(n,5,5) >mean(x) [1] 3.119021 >var (x) [1] 21.65118 b) Repeat a) 500 times and get 500 sample means. Report the sample mean of these means. What about the sample variance of these sample means. #Continued from above >Mean(rnorm(n,5,5)) [1] 7.371327 M=500 X_bar_all=replicate(m,mean(rnorm(n,5,5)))
Mean(x_bar_all) [1] 4.915064 >var(x_bar_all) [1] 2.914185 c) What is the population variance of the sample mean in part b)? What if each sample has 20 observations? (Hint: the formula on page 34 of the slides is about the standard deviation of the sample mean. You have to square it to get the formula for the variance of the sample mean) standard deviation of sample population/square root of sample size=stdev of sample mean >stdv=sd(x_bar_all) [1] 1.707098 Stdv^2=2.914185 Sqrt sample size=sqrt(10)=3.1623 Stdv of sample means=(2.91285/3.1623)=0.9215462 Population variance of the sample mean= (stdv of sample mean)^2 =(.9215461)^2=.8492474 If each Sample mean had 20 oberservations then Sqrt sample size=sqrt(20)=4.4721 Stdv of sample means=(2.91285/4.4721)=0.651631 (0.651631)^2=0.4246237= population variance of the sample mean 3. State Central Limit Theorem. When n is large, the sampling distribution od x is approximately a normal distribution with u x = u and standard deviation = stdv/ square root sample size. The larger the sample size is, the better the normal approximation will be to the sample distribution. 4. Please refer to Problem 3 above. We can generate a random sample with n observa- tions from the chi-squared distribution with k degrees of freedom via rchisq(n,k) a) Generate m = 1000 samples from chi-squared distribution with k = 3 degrees of freedom, with each sample having n = 2 observations. Draw a histogram of these 1000 sample means. Does the histogram look symmetric? >rchisq(2,3) [1] 3.77 0.807
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
>mean(rchisq(2,3)) [1] 4.905 >n=2 M=1000 >x_bar_all=rep(0,m) >for(I in 1:m){} >x=rchisq(n,3) X_bar=mean(x) X_bar_all[i]=x_bar Hist(x_bar_all The histogram does not look symmetric. b) Repeat the procedure in a) with n = 100 and m = 1000. Draw the histogram of the sample means. Do you see any differences between the two histograms? Explain why. The graph does change, when changing the value of m, the graph becomes steeper.