Heights of adults. (7.7, p. 260) 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.
First let’s look at the data set and summary of heights:
head(bdims$hgt)
## [1] 174.0 175.3 193.5 186.5 187.2 181.5
summary(bdims$hgt)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 147.2 163.8 170.3 171.1 177.8 198.1
(a): The point estimate for the average height is 171.1 and median is 170.3.
sd(bdims$hgt)
## [1] 9.407205
(b): The point estimate for the standard deviation is 9.4. The IQR is 3rd Qu - 1st Qu which is 177.8 - 163.8 = 14
(c): Calculate how many standard deviation away from the mean for both 180cm and 155cm height values.
z_180 <- (180-171.1)/9.4
z_150 <- (155-171.1)/9.4
z_180
## [1] 0.9468085
z_150
## [1] -1.712766
180 cm falls within 1 std away from the man. 155cm height falls within 2 std away from the mean. They are both not unusual heights.
(d): Sample statistics vary from sample to sample. So we dont expect the same mean and the standard deviation for this new sample set.
se <- 9.4/sqrt(507)
se
## [1] 0.4174687
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.
First let’s look at the summary of the dataset and spending
head(tgSpending$spending)
## [1] 52.84612 187.55311 63.87256 195.56842 120.78929 63.26765
summary(tgSpending$spending)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 5.719 49.177 75.792 84.707 112.255 282.803
sd(tgSpending$spending)
## [1] 46.92851
(a): Correct: We are 95% confident that ameircan spending average between $80.31 and $89.11
(b): False: The sampled observations are independent, they are randomly sampled. Sample is slighlty right skewed however it is not extremly skewed and the sample size is greater than 30.
(c): False: 95% confident means that 95% of the intervals contains the true population mean. This does not mean that 95% of the random samples have sample means between 80.31 and 89.11
(d): Correct:
(e): Correct: In order to increase the confidence level, we create wider intervals. So instead of 95% confidence level, we are norrowing down the interval for 90% confidence level. Interval would be narrower with less possible values in terms of spending in 90% confidence interval.
(f): \(SE=\sigma/\sqrt{n}\) based on this, n is the sample size, if we want to decrease the margin of error by 3 times, we would need to increase the sample size by more than 3 times. (at least 9 times)
(g): Correct: Confidence level is point estimate +- Z * SE and Z * SE is margin of error
se2 <- 46.92/sqrt(436)
# for 95% confidence level z= 1.96
z_2 <- se2 * 1.96
z_2
## [1] 4.404239
Gifted children, Part I. Researchers investigating characteristics of gifted children col- lected 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 dis- tribution of the ages (in months) at which these children first counted to 10 successfully. Also provided are some sample statistics.
First let’s look at the dataset and summary of count of gifted children
head(gifted$count)
## [1] 26 37 32 24 34 28
summary(gifted$count)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 21.00 28.00 31.00 30.69 34.25 39.00
sd(gifted$count)
## [1] 4.314887
Yes. The observations are independent and randomly sampled. The sample size is less than 10% of the population (considering the population of a large city). The distribution is not extremly skewed.
The associated hypothesis are
\(H_{o}: \mu= 32\) : Children on average 32 months count to 10 successfully.
\(H_{A}: \mu<32\) : Children on average less than 32 months count to 10 successfully.
The parameter of interest is the avertage months of children that counts to 10 successfully. We look at the test statistics to find how many standard deviations away from the sample mean.
\(SE=\sigma/\sqrt{n}\)
se <- 4.31/sqrt(36)
z <- (32-(30.69))/se
se
## [1] 0.7183333
z
## [1] 1.823666
The sample mean is 1.82 standard error away from the hypthesis value. We can quantify to see if this is unusual to accept or reject the hyphothesis by calculating p-value. If the pvalue is lower than significance level (0.10) we reject the \(H_{o}\)
pnorm(q=30.69, mean = 32, sd= se, lower.tail = TRUE)
## [1] 0.0341013
(c): p-value is 0.034 less than the signifance level of 0.10 , we reject the \(H_{o}\) . There is 0.034 chance of observing random sample of 36 children who are average 32 months first counted to 10 successfully.
(d): 90% confidence interval Z score is 1.64.
30.69 - (1.64*se)
## [1] 29.51193
30.69 + (1.64*se)
## [1] 31.86807
It is 29.5 to 31.86
(e): Yes. \(H_{A}\) which is less than 32 months count to 10 successfully. Both (29.51) and (31.86) are below 32.
Gifted children, Part II. Exercise above 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.
First lets get the dataset and summary of motheriq
head(gifted$motheriq)
## [1] 117 113 118 131 109 109
summary(gifted$motheriq)
## Min. 1st Qu. Median Mean 3rd Qu. Max.
## 101.0 113.8 118.0 118.2 122.2 131.0
sd(gifted$motheriq)
## [1] 6.504943
(a): \(H_{o}: \mu=100\) : Data provide convincing evidence that the average IQ of mother of gifted children is same
\(H_{A}: \mu \neq 100\) : Different is the alternative hypothesis
# calculate se score
se_8 <- 6.5/sqrt(36)
# calculate z score
z_score <- (118.2-100)/se_8
# calculate p value
pnorm(q=118.2, mean=100, sd=6.5, lower.tail = TRUE)
## [1] 0.9974449
The p value is 0.99. With significance level of 0.10, we reject the \(H_{o}\) hypthosis.
(b): 90% confidence interval Z score is 1.64.
118.2 - (1.64*se_8)
## [1] 116.4233
118.2 + (1.64*se_8)
## [1] 119.9767
(c): The confidence interval is 116.4 — 119.9, 100 is not within the interval, hence we reject the \(H_{o}\) which is the same as our hypethesis test.
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.
Sampling distribution is the distribution of sample means from a sample size. The variablity of the sampling distribution is smaller than the variability of the poupulation distribution as sample means will vary less than the individual observations. If we increase the sample size. sampling distribution shape will become more symmetric , center would become about the same and spread would become smaller.
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.
(a):
m_bulbs <- 9000
sd_bulbs <- 1000
z_bulbs <- (10500-m_bulbs)/sd_bulbs
z_bulbs
## [1] 1.5
p_bulbs <- (1-pnorm(q=10500, mean = m_bulbs, sd=sd_bulbs))
p_bulbs
## [1] 0.0668072
(b):
The lifespan of the lightbulbs are nearly normally distributed. The sample size 15. mean is 9000.
se_bulbs <- sd_bulbs/sqrt(15)
se_bulbs
## [1] 258.1989
(c):
z_bulbs_sample <- ((10500-m_bulbs)/se_bulbs)
p_sample_bulbs <- (1-pnorm(q=10500, mean = m_bulbs, sd=se_bulbs))
p_sample_bulbs
## [1] 3.133452e-09
(d):
#using normal plot
library('DATA606')
## Loading required package: shiny
## Loading required package: OIdata
## Loading required package: RCurl
## Loading required package: bitops
## Loading required package: maps
## Loading required package: ggplot2
##
## Attaching package: 'ggplot2'
## The following object is masked from 'package:openintro':
##
## diamonds
## Loading required package: markdown
##
## 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.
##
## Attaching package: 'DATA606'
## The following object is masked from 'package:utils':
##
## demo
normalPlot(mean=m_bulbs, sd=sd_bulbs)
normalPlot(mean = m_bulbs, sd=se_bulbs)
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.
Basically our sample size became x10. The standard error will deacrease. The spread of the sample distribution will get bigger. p value will decrease.