getwd()
## [1] "/Users/Darwinbeliever01/Desktop/math 217/week_5/quiz chpt 4"

question 1

#The harmless Corn Snake is a relative of the Black Rat snake; it is usually brilliantly colored with large orange blotches bordered with black down the back. Its background color is tan to gray. It is not as common as the black rat snake; found in rural areas of Maryland. Lengths of adult corn snakes are normally distributed. # we are given the the normal distribution so mean 0 and sd 1.

#a) What percentage of corn snake lengths in the Maryland population are within ±2.5 standard deviations from the mean? so here we need to calculate AUC from -2.5 to +2.5.

knitr::include_graphics("1_a.png")

(pnorm(2.5,0,1)-pnorm(-2.5,0,1))*100
## [1] 98.75807

#interpretation: for the normal distributed corn snake population of maryland, 98.7% of snake lengths are within +/- 2.5 sd of mean

#b) If the mean adult length is 41.5 inches and the standard deviation is 2.13 in, what corn snake lengths are in the 90th percentile or higher? DRAW/LABEL/SHADE

knitr::include_graphics("1_b.png")

#here find z score for 90th percentile using qnorm fx where ybar = 41.5 and sigma = 2.13

qnorm(.9,41.5, 2.13)
## [1] 44.2297

#interpretation: for distribution mean 41.1, sd 2.13, snakes 44.2 inches or greater area at or above the 90th percentile

question 2

#In an agricultural experiment, a large uniform field was planted with a variety of soy. The field was divided into many equal-sized plots and the yield in pounds was measured for each plot. The plot yields followed a relatively normal distribution with mean 107 lbs and standard deviation 6.3 lbs.

#a. Calculate the z-score for a plot that yields 120 lbs or more. here we used the z score formula z = (Y - mu)/sigma, where Y = 120, mu = 107 and sigma = 6.3

z120 <-(120-107)/6.3

print(z120)
## [1] 2.063492

#interpretation: z >= +2.063492 is score for soybean yields of 120lb or greater

#b. What is the probability that plot yields were 120 lbs or more? (DRAW/LABEL/SHADE a curve then show proper notation and calculations) here we use the pnorm fx where Pr{Y>=120} and apply the complement to obtain AUC to the right

knitr::include_graphics("2_b.png")

Y120 <- (1-pnorm(120,107,6.3))*100
print(Y120)
## [1] 1.953295

#interpretation: there is 1.95% chance that soybean plot yields will be >= 120 lbs

#c. Find the yield that is in the top 10% for this distribution. (DRAW/LABEL/SHADE a curve then show proper notation and calculations) here we want the z score for the 10% percentile given mean 107 sd 6.3. we use the qnorm fx for q=0.9, mean 107, sd 6.3.

knitr::include_graphics("2_c.png")

z90 <-qnorm(0.9,107,6.3)
print(z90)
## [1] 115.0738

#interpretation: 115.07 lbs is the top 10th percentile of soy plot yields

question 3

#The following normal quantile plot was created based on BMI of 100 males. Comment on the distribution based on this quantile-quantile plot AND the results of the Shapiro Wilks Test for Normality

knitr::include_graphics("3.png")

#given p = 0.01604 for BMI distribution n = 100 males, there is moderate evidence for nonnormality (p<0.05)