Using R script functions generate random samples and calculate sample means. Be sure to solve all 3 parts of this problem.
Please show the R script coding/steps to solve this. Please do all 3 parts of this question!!! Thanks in advance!!! :)
Assume that we have a normal population with a mean of 10 and a variance of 22, i.e., X∼N(10,22). In R, consider using the rnorm()function that is used to draw random values from a normal distribution (so it starts with ‘r’). It can be implemented as rnorm(n, mean, sd) where n is the number of random values to draw, and mean and sd are the mean and the standard deviation of the normal distribution from which random values are drawn.
Part 1: By using the rnorm()function, generate a random sample of size 1500 from the population and draw a histogram of the randomly drawn values.
Part 2: From the population, draw 50 random samples of size 30. Calculate the sample mean of each random sample generating 50 sample means from 50 random samples. Draw a histogram of the sample means.
Part 3: Compare the distributions of the population and the sample mean in terms of location and variability (by comparing the histograms). For this, calculate the mean and standard deviation of 1500 X’s in part 1 and the mean and standard deviation of 50 X’s in part 2. Determine if there is any significant difference in location or variability between the two distributions. If there is a difference, why do you see such a difference (think about the mathematical expressions)?