Question: ASAP PLS SUING R CODE ###################### Part 5 : For - loop y = numeric ( 1 0 0 ) # Create space for y

ASAP PLS SUING R CODE ###################### Part 5: For-loop
y = numeric(100) # Create space for y to receive 100 numbers.
for(i in 1:100){
y[i]=2*i # Fill y with 2,4,6,8,...,200.
}
y # Always look!
##################### Part 6: Empirical Sampling Distribution of the Sample Mean
ntrial =10000
ybar = numeric(ntrial) # Create space to store 10000 sample means.
for(i in 1:ntrial){
s = rnorm(100,1,2) # Sample of size 100 from Norm with mu=1, sigma=2
ybar[i]= mean(s) # Sample mean, stored in y
}
ybar # 10000 sample means.
hist(ybar, breaks=20) # You are looking at the Empirical Sampling Distribution of the Sample Mean.
mean(ybar) # About 1, which happens to be the mu of the population.
sd(ybar) # About 0.2, which happens to be 2/sqrt(100), i.e., sigma/sqrt(n)..
Question 2
a) Revise above code to generate the empirical sampling distribution of the sample maximum.
b) We have seen that the mean of the empirical sampling distribution of the sample mean is related to the population mean. Is the mean of the empirical sampling distribution of the sample maximum related to population maximum? Give some explanation for your answer.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!