Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You have to use R to complete this exercise. [In your R document, type comments (lines that start with #) to both (i) explain what
You have to use R to complete this exercise. [In your R document, type comments (lines that start with #) to both (i) explain what your R commands do, and (ii) answer questions in the problem below.]
Open the file "hw1_9.R". It contains a couple of commands that read data from the file "PHISH.csv" and converts the data into numeric format and stores in variable x. This variable contains data for the entire population.Treat this file as a start-up/template file and complete the exercise by adding to it commands that would solve the problems below. Don't forget to type your name on line 3 of the file. a. Construct a frequency histogram of variable x using the R command hist().
b. Find the population mean and variance of x using commands mean() and var().
c. Suppose a random sample of n = 40 (with replacement) selected from the population. Describe what you would expect the shape of the sampling distribution of x , the sample mean. Theoretically, what are the mean and variance of x ?
d. Find P x ! 90 using command pnorm().
e. (Use the approach in the file "CLT.R" to complete this part.) Use a random number generator (the R command sample() with option replace=TRUE) to select a random sample of size n = 40 from the population and compute x . Repeat this M = 1000 times and store values of x in a separate vector. Produce a histogram for these values of x . Is the shape approximately normal? Why or why not?
f. Refer to part e. Find the mean and variance of the x values. Are these values approximately equal to the mean and variance found in part c?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started