##
## Welcome to CUNY DATA606 Statistics and Probability for Data Analytics
## This package is designed to support this course. The text book used
## is OpenIntro Statistics, 3rd Edition. You can read this by typing
## vignette('os3') or visit www.OpenIntro.org.
##
## The getLabs() function will return a list of the labs available.
##
## The demo(package='DATA606') will list the demos that are available.
Graded: 4.04, 4.14, 4.24, 4.26, 4.34, 4.40, 4.48
4.04 Heights of adults. Researchers studying anthropometry collected body girth measurements and skeletal diameter measurements, as well as age, weight, height and gender, for 507 physically active individuals. The histogram below shows the sample distribution of heights in centimeters.
sd and 14 for IQR.q3 <- 177.8
q1 <- 163.8
q3-q1## [1] 14
sd of the mean, and would not be considered abnormally tall.sd of the mean, which would consist of a smaller proportion of the sampled population. If normally distributed, 68% of the population should fall within 1 sd of the mean, and 95% would fall within 2 sd. Thus, this height would be less common than 180 cm, but not unsual.m <- 171.1
sd <- 9.4
sd1 <- range(c(m+sd, m-sd))
sd2 <- range(c(m+sd*2, m-sd*2))
sd3 <- range(c(m+sd*3, m-sd*3))
rbind(sd1, sd2, sd3)## [,1] [,2]
## sd1 161.7 180.5
## sd2 152.3 189.9
## sd3 142.9 199.3
se) to quantify the variability of this estimate.se<-sd/sqrt(507)
se## [1] 0.4174687
4.14 Thanksgiving spending, Part I. The 2009 holiday retail season, which kicked off on November 27, 2009 (the day after Thanksgiving), had been marked by somewhat lower self-reported consumer spending than was seen during the comparable period in 2008. To get an estimate of consumer spending, 436 randomly sampled American adults were surveyed. Daily consumer spending for the six-day period after Thanksgiving, spanning the Black Friday weekend and Cyber Monday, averaged $84.71. A 95% confidence interval based on this sample is ($80.31, $89.11). Determine whether the following statements are true or false, and explain your reasoning.
$80.31 and $89.11.
$80.31 and $89.11.
se, we divide sd by the square root of the sample size. Thus, we would need to multiply the sample size by 9 in order to decrease the me by 1/3rd.n <- 436
sd<-(89.11-80.31)/2
se<-sd/sqrt(n)
z<-1.96
me <- z * se
me## [1] 0.4130147
4.24 Gifted children, Part I. Researchers investigating characteristics of gifted children collected data from schools in a large city on a random sample of thirty-six children who were identified as gifted children soon after they reached the age of four. The following histogram shows the distribution of the ages (in months) at which these children first counted to 10 successfully. Also provided are some sample statistics.
m<-30.69
sd<-4.31
h<-32
n<-36
se<-sd/sqrt(n)
z = (m-h)/se
p = pnorm(z,lower.tail = TRUE)
p## [1] 0.0341013
z=1.65
lowerCI <- m - (z * se)
upperCI <- m + (z * se)
rbind(lowerCI, upperCI)## [,1]
## lowerCI 29.50475
## upperCI 31.87525
29.5 and 31.9.4.26 Gifted children, Part II. Exercise 4.24 describes a study on gifted children. In this study, along with variables on the children, the researchers also collected data on the mother’s and father’s IQ of the 36 randomly sampled gifted children. The histogram below shows the distribution of mother’s IQ. Also provided are some sample statistics.
m<-118.2
sd<-6.5
h<-100
n<-36
se<-sd/sqrt(n)
z = (m-h)/se
p = 1-pnorm(z)
p## [1] 0
We interpret can interpret the significantly small p value to mean that the H0 mean would be highly uncommon, if not impossible. The value and significance level would lead us to reject the H0 in favor of HA.
z=1.65
lowerCI <- m - (z * se)
upperCI <- m + (z * se)
rbind(lowerCI, upperCI)## [,1]
## lowerCI 116.4125
## upperCI 119.9875
4.34 CLT. Define the term “sampling distribution” of the mean, and describe how the shape, center, and spread of the sampling distribution of the mean change as sample size increases. + The sampling distribution of the mean contains the distribution of all sample means of a selected number of samples. + The central limit theory allows these sample means to be approximated as a normal distribtion. + As the sample size increases, this approximation becomes closer to the population mean.
4.40 CFLBs. A manufacturer of compact fluorescent light bulbs advertises that the distribution of the lifespans of these light bulbs is nearly normal with a mean of 9,000 hours and a standard deviation of 1,000 hours.
m <- 9000
sd <- 1000
h <- 10500
z <- (h - m) / sd
p = 1-pnorm(z)
p## [1] 0.0668072
pnorm(h - m)/(sd/sqrt(15))## [1] 0.003872983
4.48 Same observation, different sample size. Suppose you conduct a hypothesis test based on a sample where the sample size is n = 50, and arrive at a p-value of 0.08. You then refer back to your notes and discover that you made a careless mistake, the sample size should have been n = 500. Will your p-value increase, decrease, or stay the same? Explain. + The p-value should decrease, because it is dependent on the square root and sample size.