50.4k views
1 vote
g In R simulate a sample of size 20 from a normal distribution with mean µ = 50 and standard deviation σ = 6. Hint: Use rnorm(20,50,6) to get one random sample of size 20. Determine the mean and standard deviation from this sample, compare these with the population mean and standard deviation.

2 Answers

4 votes

Answer:

b

Explanation:

User Imdibiji
by
5.8k points
3 votes

Answer:

> a<-rnorm(20,50,6)

> a

[1] 51.72213 53.09989 59.89221 32.44023 47.59386 33.59892 47.26718 55.61510 47.95505 48.19296 54.46905

[12] 45.78072 57.30045 57.91624 50.83297 52.61790 62.07713 53.75661 49.34651 53.01501

Then we can find the mean and the standard deviation with the following formulas:

> mean(a)

[1] 50.72451

> sqrt(var(a))

[1] 7.470221

Explanation:

For this case first we need to create the sample of size 20 for the following distribution:


X\sim N(\mu = 50, \sigma =6)

And we can use the following code: rnorm(20,50,6) and we got this output:

> a<-rnorm(20,50,6)

> a

[1] 51.72213 53.09989 59.89221 32.44023 47.59386 33.59892 47.26718 55.61510 47.95505 48.19296 54.46905

[12] 45.78072 57.30045 57.91624 50.83297 52.61790 62.07713 53.75661 49.34651 53.01501

Then we can find the mean and the standard deviation with the following formulas:

> mean(a)

[1] 50.72451

> sqrt(var(a))

[1] 7.470221

User Luke Whyte
by
5.5k points