1)

a.)

p <- .2
n <- 10

dbinom(0,size = n, prob = p)
## [1] 0.1073742

P(None pass through turnstile A) = 0.1073742

b.)

dbinom(3,size = n, prob = p)
## [1] 0.2013266

P(Exactly three pass through turnstile A) = 0.2013266

c.)

p1 <- .4
dbinom(0,size = n, prob = p1)
## [1] 0.006046618

P(All pass through turnstiles C, D, and E) = 0.0060466

d.)

p2 <- .6
pbinom(4,size = n, prob = p2)
## [1] 0.1662386

P(Fewer than half of the visitors enter through turnstiles C,D, and E) = 0.1662386

2.)

a.)

mu <- 105
sigma <- 5 
pnorm(100, mean = mu, sd = sigma, lower.tail = TRUE)
## [1] 0.1586553

b.)

## -1.6449 standard deviations below creates area under curve of .95. Divide this z-score by current standard deviation, 5, to find answer.
5/1.644
## [1] 3.041363

Standard deviation necessary to allow 95% of bars to be above 100 grams is 3.0413625

c.)

## Multiply standard deviation that results in area of .95 under curve (found in the previous part) by the new standard deviation of 4. Then, add 100 to find the new mean
100+4*1.644
## [1] 106.576

The mean necessary to keep 95% of the bars of soap at at least 100 grams is 106.576

3.)

a.) About .43 standard deviations above and below the mean to capture 1/3.

b.) The top 10% of values are about 1.28 standard deviations above the mean.

c.) 99.74% of values lie within 3 standard deviations of the mean

d.) The distance between mean and 75th percentile is about .67 standard deviations.

e.) 2 standard deviations above the mean is the 97.72nd percentile.

f.) The bottom 5% of values lie 1.65 standard deviations below the mean.

4.)

a.)

hist(iris$Sepal.Length[iris$Species=="virginica"], breaks = 20)

b.) It is not perfectly normal, but roughly follows the normal curve. It is skewed to the right.

c.)

x <- iris$Sepal.Length[iris$Species=="virginica"]
(mu3 <- mean(x))
## [1] 6.588
(sigma3 <- sd(x))
## [1] 0.6358796

d.)

mean(x < 6.25)
## [1] 0.26

e.)

(mu3-6.25)/sigma3
## [1] 0.5315472

Z chart displays that the area below .53 SDs below the mean comprises 29.81% of the total.

f.)

sort(x)
##  [1] 4.9 5.6 5.7 5.8 5.8 5.8 5.9 6.0 6.0 6.1 6.1 6.2 6.2 6.3 6.3 6.3 6.3 6.3 6.3
## [20] 6.4 6.4 6.4 6.4 6.4 6.5 6.5 6.5 6.5 6.7 6.7 6.7 6.7 6.7 6.8 6.8 6.9 6.9 6.9
## [39] 7.1 7.2 7.2 7.2 7.3 7.4 7.6 7.7 7.7 7.7 7.7 7.9

g.)

(y <- (qnorm(.9, mean = mu3, sd = sigma3)))
## [1] 7.402912

h.) The findings would support the claim that the distribution is normal.

i.)

qqnorm(x)

j.) Based on the Q-Q plot following a roughly straight line, the distribution can be consdidered normal.

5.)

vir.pl <- iris$Petal.Length[iris$Species == "virginica"]
set.pl <- iris$Petal.Length[iris$Species == "setosa"]
ver.pl <- iris$Petal.Length[iris$Species == "versicolor"]
boxplot(vir.pl,set.pl,ver.pl, names=c("virginica","setosa","versicolor"))

a.) Setosa and Versicolor

b.) Virginica

c.) Virginica: Roughly normal, skewed right. Setosa: Roughly normal. Versicolor: Roughly normal, skewed left.

d.) Sestosa, Versicolor, Virginica; in order of smallest variance to greatest.

e.)

var(vir.pl)
## [1] 0.3045878
var(set.pl)
## [1] 0.03015918
var(ver.pl)
## [1] 0.2208163

f.) A wider range between maximum and minimum values, and a wider range between
first and third quartiles may suggest a higher variance in the sample.

6.)

simulated.data <- rexp(1000,.01)
simulated.data2 <- - rexp(1000,.01)

a.)

par(mfrow=c(1,2)) 
hist(simulated.data)
boxplot(simulated.data)

b.)

hist(simulated.data2)

c.) Attached

d.) simulated.data 1 is right-skewed. simulated.data 2 is left-skewed.