Using R Studio Now, set the seed to 348 with `set.seed()`. Then take a sample of size...

70.2K

Verified Solution

Question

Basic Math

Using R Studio

Now, set the seed to 348 with `set.seed()`. Then take a sampleof size 10,000 from a normal distribution with a mean of 82 and astandard deviation of 11.

(a) Using sum() on a logical vector, how many draws are lessthan 60? Using mean() on a logical vector, what proportion of thetotal draws is that? How far is your answer from pnorm() in 1.1above?


```{R}
set.seed(348)
x=rnorm(10000,82,11)
sum(ifelse(x<60,1,0))

mean(ifelse(x<60,1,0))

pnorm(60,82,11)

Using sum() function there are 128 draws that are less than 60and using the mean() function 0.0281 is the porportion of totaldraws. From these outputs we can say that the answer is quite closeto the pnorm() value that has been calculated.

(b) What proportion of your sample is greater than 110 or lessthan 54?

(c) Why are your answers close to what you got above? Why arethey not exactly the same?

(d) Using ggplot2, make a histogram of your sample. Sety=..density.. inside aes(). Overlay a normal distribution withstat_function(aes(samp), fun=dnorm, args=list(82,11)). Usinggeom_vline(xintercept=), add dashed vertical lines corresponding tothe 2.5th and the 97.5th percentile of the sample

Answer & Explanation Solved by verified expert
4.4 Ratings (811 Votes)
a Using sum on a logical vector how many draws    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students