In this project, students will demonstrate their understanding of the normal distribution, sampling distributions, and confidence intervals and hypothesis tests.
Assume IQ scores are normally distributed with a mean of 100 and a standard deviation of 15. If a person is randomly selected, find each of the requested probabilities, using r chunks below. Here, x, denotes the IQ of the randomly selected person.
pnorm(120, mean = 100, sd = 15, lower.tail = FALSE)
## [1] 0.09121122
pnorm(120, mean = 100, sd = 15, lower.tail = TRUE)
## [1] 0.9087888
1 - (pnorm(80,100,15,lower.tail = TRUE)+pnorm(120,100,15,lower.tail = FALSE))
## [1] 0.8175776
pnorm(120,100,15,lower.tail = FALSE)
## [1] 0.09121122
Load and store the sample NSCC Student Dataset using the read.csv() function. Find the mean and sample size of the PulseRate variable in this dataset and answer the question that follows below.
# Store the NSCC student dataset in environment
nsccstudents <- read.csv("nscc_student_data.csv")
# Find the mean pulse rate of this sample
mnpulse <- mean(nsccstudents$PulseRate,na.rm=TRUE)
#mean is 73.47368421
# Find the sample size of pulse rates (hint: its how many non-NA values are there)
sum(!is.na(nsccstudents$PulseRate))
## [1] 38
#sample size is 38 people excluding NA values
Do you think it is likely or unlikely that the population mean pulse rate for all NSCC students is exactly equal to that sample mean found?
it is extremely unlikely to get a mean that is exact to the sample, but it is likely that the population mean is similar to the sample mean.
If we assume the mean pulse rate for all NSCC students is \(\sigma = 14\), construct a 95% confidence
interval for the mean pulse rate of all NSCC students and conclude in a
complete sentence below.
(Note: we can create a valid confidence interval here since n >
30)
# Store mean
# I stored the mean for pulserate in question 3
# Calculate lower bound of 95% CI
qnorm(0.025,mean = mnpulse, sd = 14)
## [1] 46.03419
# Calculate upper bound of 95% CI
qnorm(1-0.025,mean = mnpulse, sd = 14)
## [1] 100.9132
#we used the qnorm function to determine the upper and lower bounds of the confidence intervals.
I am 95% confident that…
the average pulse rate among all NSCC students is between 46.03bpm and
100.91bpm.
Construct a 99% confidence interval for the mean pulse rate of all NSCC students and conclude your result in a complete sentence below the R chunk.
# Calculate lower bound of 99% CI
qnorm(0.005,mean = mnpulse, sd = 14)
## [1] 37.41207
# Calculate upper bound of 99% CI
qnorm(1-0.005,mean = mnpulse, sd = 14)
## [1] 109.5353
#using the same function as in question 4, we have changed the p value to 0.005 to make a confidence level of 99%.
I am 99% confident that… the pulse rate of all NSCC students is between 37.41bpm and 109.54bpm.
Describe and explain the difference you observe in your confidence interval results for questions 5 and 6.
With a larger confidence interval, we see a larger distance between the upper and lower bounds. it also makes sense that the differences between the bounds is roughly 9 bpm.
In the Fall 2019 semester of the 2019-20 academic year, the average NSCC student took 12.3 credits with \(\sigma = 3.4\). I’m curious if that average differs among NSCC students last year (a sample of which is in the NSCC student dataset). Conduct a hypothesis test by a confidence interval to determine if the average credits differs last year from Fall 2019.
Ho: 12.3 = mu of nsccstudents
Ha: 12.3 != mu of nsccstudents
# Calculate mean of Credits variable
mncredits <- mean(nsccstudents$Credits)
sdcredits <- sd(nsccstudents$Credits)
# Calculate sample size of Credits variable
sum(!is.na(nsccstudents$Credits))
## [1] 40
# Lower bound of 95% CI
qnorm(0.025,mncredits,sdcredits)
## [1] 5.169505
# Upper bound of 95% CI
qnorm(1-0.025,mncredits,sdcredits)
## [1] 18.3805
We fail to reject Ho due to the fact that the average credits taken was well within the confidence interval of the current data.
the amount of credits taken is very similar to how it was in 2019-2020. with there being little difference.
NSCC is investigating whether NSCC students have a higher than average stress level which can be identified by a higher than average standing pulse rate. Conduct a hypothesis test by the p-value method to determine if NSCC students have a higher pulse rate than the national average of 72 bpm for adults. Recall the assumption that \(\sigma = 14\) for NSCC student pulse rates.
HO: mu = 72bpm HA: mu != 72 bpm
# Calculate mean of PulseRate variable
#mean was calculated in question 3 as mnpulse value
# Probability of getting that sample data by random chance if pop mean was indeed 72bpm
pnorm(mnpulse,72,14)
## [1] 0.5419165
fail to reject HO
The stress levels of NSCC students, as recorded by pulse rate, is very similar to the national average of 72bpm.