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. Here, x, denotes the IQ of the randomly selected person.
# First assign values to the mean and standard deviation
IQ_mean <- 100
IQ_sd <- 15
#Find the probobilty that x will be more than 110
pnorm( 110, mean = IQ_mean, sd = IQ_sd, lower.tail = FALSE)
## [1] 0.2524925
The probobilty that x will be greater than 110 is 0.2524925 or 25.2%
# Find the probability that x will be less than a 110
pnorm(110, mean = IQ_mean, sd = IQ_sd, lower.tail = TRUE)
## [1] 0.7475075
The probability that x will be less than a 110 is 0.7475075 or 74.8%
#Finding students lower than 120, higher than 80
round(pnorm(120, mean= 100, sd= 15, lower.tail= TRUE), 3)
## [1] 0.909
round(pnorm(80, mean= 100, sd= 15, lower.tail= TRUE), 3)
## [1] 0.091
#Answer for probability of student IQ being between 80 amd 120
(0.909 - 0.091)
## [1] 0.818
the probability that a random selected student will have an IQ between 80 and 120 is 0.818 or about 82%
qnorm( 0.75, mean = IQ_mean, sd = IQ_sd, lower.tail = FALSE)
## [1] 89.88265
If a random sample of 12 students is selected, the probability that their mean IQ is greater than 110 is about 89.88265 or 90%
Load and store the sample NSCC Student Dataset using the read.csv() function. Find the mean, standard deviation, and sample size of the PulseRate variable in this dataset and answer the question that follows below.
# Store the NSCC student dataset in environment
nscc_student_data <- read.csv("C:/Users/samura641/Desktop/Honor Statistics/nscc_student_data.csv")
# Find the mean pulse rate of this sample
mean(nscc_student_data$PulseRate, na.rm = TRUE)
## [1] 73.47368
# Find the std dev of pulse rates of this sample
sd(nscc_student_data$PulseRate, na.rm = TRUE)
## [1] 12.51105
# Find the sample size of pulse rates (hint: its how many non-NA values are there)
# Sample size of PulseRate
table(is.na(nscc_student_data$PulseRate))
##
## FALSE TRUE
## 38 2
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 unlikely because these numbers are taken from a random group of students; meaning if one was to pick another random group, the numbers could differ.
If we assume the mean pulse rate for all NSCC students is \(\sigma = 12\), 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
mn <- mean(nscc_student_data$PulseRate, na.rm = TRUE)
# Calculate lower bound of 95% CI
mn - 1.96*(12/sqrt(38))
## [1] 69.65824
# Calculate upper bound of 95% CI
mn + 1.96*(12/sqrt(38))
## [1] 77.28913
I am 95% confident that the mean pluse rate of all nscc students is between 69.7 and 77.3
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
mn - 2.58*(12/sqrt(38))
## [1] 68.45131
# Calculate upper bound of 99% CI
mn + 2.58*(12/sqrt(38))
## [1] 78.49606
I am 99% confident that the mean pluse rate of all nscc students is between 68.5 and 78.5
## Question 6 Describe and explain the difference you observe in your confidence intervals for questions 5 and 6.
The difference between 4 and 5 is as the confidence interval increased the estimate widened.
In the Fall 2009 semester of the 2009-10 academic year, the average NSCC student took 12.1 credits with \(\sigma = 3.1\). 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 2009.
H0: ??2009 = 12.1 HA: ??2009 ??? 12.1
# Calculate mean of Credits variable
mean(nscc_student_data$Credits)
## [1] 11.775
# Calculate sample size of Credits variable
table(is.na(nscc_student_data$Credits))
##
## FALSE
## 40
# Store mean
mncredits <- mean(nscc_student_data$Credits, na.rm = TRUE)
# Lower bound of 95% CI
mncredits - 1.96*(3.1/sqrt(40))
## [1] 10.8143
# Upper bound of 95% CI
mncredits + 1.96*(3.1/sqrt(40))
## [1] 12.7357
I fail to reject the null hypothesis
There is not sufficient evidence at this time to support the claim that last year’s credit average was any different than that of the 2009-2010 school year.
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 a p-value to determine if NSCC students have a higher pulse rate than the national average of 72 bpm for adults. Recall the assumption that \(\sigma = 12\) for NSCC student pulse rates.
HA: ?? > 72
# Calculate mean of PulseRate variable
mean(nscc_student_data$PulseRate, na.rm= TRUE)
## [1] 73.47368
# Probability of getting that sample data by random chance if mean was indeed 72bpm
pnorm(73.5, mean = 72, sd= 12, lower.tail = FALSE )
## [1] 0.4502618
Since the p-value is greater then the level significance (aplha) the evidence is not very strong, therefore I fail to reject HO.
There is not sufficent data to determine that NSCC students obtain higher pulse rate then the national average of 72 bpm for adults.