Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rstudio programming : Let x = x1 + ... + x20, the sum of 20 independent Uniform(0,1) random variables. In R, create 1,000 simulations of

Rstudio programming :

Let x = x1 + ... + x20, the sum of 20 independent Uniform(0,1) random variables. In R, create 1,000 simulations of x and plot their histogram. On the histogram, overlay a graph of the normal density function with the same mean as x. Comment on any differences between the histogram and the curve. Hint 1: To plot a histogram in R you can build on the following code:

library(ggplot2)

df <- data.frame( x = rnorm(1000) )

ggplot(df, aes(x)) + geom_histogram(aes(y=..density..))

Hint 2: In ggplot you cannot plot the normal density as a function. But you can easily simulate lots of values drawn from a normal distribution (say 1,000) and plot these data as a geom_density(). The main challenge for you to figure out is how to use two ggplot layers, each with its own data.frame: The first layer uses the data from x the second uses data from the normal distribution.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Medical Image Databases

Authors: Stephen T.C. Wong

1st Edition

1461375398, 978-1461375395

More Books

Students also viewed these Databases questions

Question

Describe what makes investors normal instead of rational.

Answered: 1 week ago

Question

Conduct a needs assessment. page 269

Answered: 1 week ago