using the statistical software R and R Studio ASSIGNMENT 1. Review R Demo #2 (an
ID: 3692726 • Letter: U
Question
using the statistical software R and R StudioASSIGNMENT 1. Review R Demo #2 (and #1 if needed) and go through all of the comrnands on your 2. (15 points) Use the voter turnout data from counties. sav, as in Demo #2. Disregard the NA entries, that is, use the vector Turnout New for the population data. (a) Rename rurnout New to T. This is your population data. (b) Generate 100) simple random samples of size n = 50 and store them as TSanp100. Repeat for 500 simple random samples of sizen- 50 (store as TSamp500) and also for 1000 simple random samples of size n 50 (store as TSamp 1000). (c) Calculate the vector of sample averages for TSamp100 and store as TSamp100Ave. Repeat for TSamp500 and for TSamp1000 and store as TSamp500Ave and TSamp1000Ave, respectively. d) Create probability histograms of the sample averages. Label the x-axis and create a title. Name your histograms TSamp100Hist. TSamp500Hist. TSampl000Hist. (e) Create a normal curve with the mean and standard deviation that is expected for the distribution of sample averages, according to the central limit theorem. Name this curve TNormal (Answer the following questions in the body of your email: i. How well does your normal curve "fit" each of the histograms? i. Why is the fit not perfect, and does this contradict the central limit theorem? List several reasons. iii. What modifications can be made in generating the samples to obtain a better fit with the normal curve? 3. (10 points) Again, let T represent your population data (a) Find the mean and standard deviation of T, and name them Tmean and Tsd, respec- tively. (b) Generate 1 simple random sample of size S0 from T, and name this Tsample. (c) From your sample, create a 90% confidence interval for the true population mean. Make all of your calculations in R and name the left endpoint of your interval CI90L and the right endpoint CI90R (d) Repeat with a 99% confidence interval, naming the endpoints C199L and CI 99R. (e) Answer the following questions in the body of your email i. Does each of your confidence intervals contain the true population mean? ii. It is possible for the true population mean to be outside of the confidence inter- val. How could this happen? iii. Which confidence interval is longer and why?
Explanation / Answer
Q.3-a)
1.We will use Exponential distribution
2.Assume lambda for the Exponential distribution is 0.2
lambda = 0.2
3.Number of samples - 40
sample = 40
4.Total number of Simulations - 1000
simulations = 1000
5.Theoretical Mean of the distribution
Tmean = 1/lambda
Tmean
## [1] 5
6.Stadard Deviation of Distribution
Tsd = 1/(lambda * sqrt(40))
## [1] 0.7905694
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.