library(IS606)
##
## Welcome to CUNY IS606 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='IS606') will list the demos that are available.
##
## Attaching package: 'IS606'
## The following object is masked from 'package:utils':
##
## demo
library(StMoSim)
## Warning: package 'StMoSim' was built under R version 3.2.3
## Loading required package: RcppParallel
## Warning: package 'RcppParallel' was built under R version 3.2.3
## Loading required package: Rcpp
## Warning: package 'Rcpp' was built under R version 3.2.3
Min 147.2 Q1 163.8 Median 170.3 Mean 171.1 SD 9.4 Q3 177.8 Max 198.1
(a) What is the point estimate for the average height of active individuals? What about the median? (See the next page for parts (b)-(e).)
i. Point estimate (mean) - 170.3 cms.
ii. Median - 171.1 cms.
(b) What is the point estimate for the standard deviation of the heights of active individuals? What about the IQR?
i. SD = 9.4 cms.
ii. IQR = Q3 - Q1 = 177.8 - 163.8 = 14
(c) Is a person who is 1m 80cm (180 cm) tall considered unusually tall? And is a person who is 1m 55cm (155cm) considered unusually short? Explain your reasoning.
It depends on what is considered unusual. 180 cms. is above Q3 (75th percentile) of of the point sample and 155 cms. is below Q1 (25th percentile). If 'unusual' means above the Q3 percentile or below the Q1 percentile, then both data fit the definition. If 'unusual' means 2 standard deviations from the mean, then both data are NOT unusual since both are within 1 standard deviation of the mean. But since this is only a point sample of the entire population, no conclusions should be drawn about the population data.
(d) The researchers take another random sample of physically active individuals. Would you expect the mean and the standard deviation of this new sample to be the ones given above? Explain your reasoning.
No, the mean and standard deviation is likely to be different. Since the random sample is another set of data from a variable population of active individuals, the mean and the standard deviation should be different and the difference is a function of the variability of the population data.
(e) The sample means obtained are point estimates for the mean height of all active individuals, if the sample of individuals is equivalent to a simple random sample. What measure do we use to quantify the variability of such an estimate (Hint: recall that SD¯ x = pn)? Compute this quantity using the data from the original sample under the condition that the data are a simple random sample.
SD(mean of sample X) = SD of sample X/sqrt of sample n
= 9.4 / SQRT(507)
= 0.42
(a) We are 95% confident that the average spending of these 436 American adults is between $80.31 and $89.11.
FALSE; Confidence interval is about the population and not just the sample.
(b) This confidence interval is not valid since the distribution of spending in the sample is right skewed.
FALSE; A large sample size of 436 randomly sampled American adults make up for the sample distribution to be rightly skewed.
(c) 95% of random samples have a sample mean between $80.31 and $89.11.
FALSE; a different sample may have a different range.
(d) We are 95% confident that the average spending of all American adults is between $80.31 and $89.11.
TRUE;
(e) A 90% confidence interval would be narrower than the 95% confidence interval since we don’t need to be as sure about our estimate.
TRUE; The smaller the confidence interval the narrower the interval.
(f) In order to decrease the margin of error of a 95% confidence interval to a third of what it is now, we would need to use a sample 3 times larger.
FALSE; Margin of error = z * SE = z * (s/sqrt(n)) We need the sample size to be 9 times larger to decrease margin of error by 3
(g) The margin of error is 4.4.
TRUE
(a) Are conditions for inference satisfied?
(b) Suppose you read online that children first count to 10 successfully when they are 32 months old, on average. Perform a hypothesis test to evaluate if these data provide convincing evidence that the average age at which gifted children first count to 10 successfully is less than the general average of 32 months. Use a significance level of 0.10.
H(null): u = 32 months
H(alternative): u < 32 months
significance level = 0.10
(c) Interpret the p-value in context of the hypothesis test and the data.
z = (30.69 - 32) / 4.31 = -0.30
pnorm(-0.30) = 0.38
p-value = 0.38
if the null hypothesis is true, the probability of observing a sample mean of 30.69 is 0.38. This is greater than significance 0.10 which means we cannot reject the null hypothesis.
(d) Calculate a 90% confidence interval for the average age at which gifted children first count to 10 successfully.
SE = 4.31/SQRT(36) = 0.72
30.87 +/- (z-score for 90% confidence interval * SE)
30.69 +/- (1.645 * 0.72) = (29.51, 31.87)
(e) Do your results from the hypothesis test and the confidence interval agree? Explain.
No they don’t. The hypothesis shows that there is a high probability of observing the sample mean (0.38). But the sample mean is not within the confidence interval (since we chose a narrow 90% confidence interval). For a 90% confidence, 10% of sample means are not captured in the interval.
n 36 min 101 mean 118.2 sd 6.5 max 131
(a) Perform a hypothesis test to evaluate if these data provide convincing evidence that the average IQ of mothers of gifted children is different than the average IQ for the population at large, which is 100. Use a significance level of 0.10.
H(null): u = 100
H(alternative): u > 100
significance level = 0.10
z = (118.2 - 100) / 6.5 = 2.8
pnorm(2.8) = 0.997
p-value = 0.003
If the null hypothesis is true, the probability of observing a sample mean of 118.2 is only 0.003. This is a lot less than the significance value of 0.10. Thus we can reject the null hypothesis and say that for this population (mother's of gifted children), their IQ is greater than the general population.
(b) Calculate a 90% confidence interval for the average IQ of mothers of gifted children.
SE = 6.5/SQRT(36) = 1.08
118.2 +/- (z-score for 90% confidence interval * SE)
118.2 +/- (1.645 * 1.08) = (116.42, 119.98)
The general population mean of 100 is outside the 90% confidence interval for the mean of the IQ of Mom's with gifted kids.
(c) Do your results from the hypothesis test and the confidence interval agree? Explain.
Yes they do. The p-value shows a big difference between significance level and p-value. This means that there is only a 0.003 chance that the sample mean is valid for the general population and we can resoundly reject the null hypothesis. The confidence interval for the IQ of Mom's with gifted kids is also way off the population mean of 100. This means that with 90% confidence, we can reject the null hypothesis.
Sampling distribution of the mean is when we take random, independent samples of a constant sample size n. The graph showing the distribution of the values of the mean from all the samples taken is called the sampling distriubtion of the mean. The sampling distribution of the mean obeys the Central Limit Theorem in that it has a normal distirubtion (given sample size >= 30, and not overly skewed) and would tend towards the mean (sread becomes narrower) as sample size increases.
As the sample size increases -
1. shape - closer to a normal distribution (normal curve)
2. center - becomes taller (increase frequency of values that is close to the true population mean)
3. spread - becomes narrower
(a) What is the probability that a randomly chosen light bulb lasts more than 10,500 hours?
z = (10,500 - 9,000)/1,000 = 1.5
1 - pnorm(1.5) = 0.07
(b) Describe the distribution of the mean lifespan of 15 light bulbs.
Since the population distribution is nearly normal N(9000, 1000) is nearly normal, the SE for the sample is 1000/SQRT(15) = 258.
(c) What is the probability that the mean lifespan of 15 randomly chosen light bulbs is more than 10,500 hours?
z= (10,500 - 9,000)/258 = 5.81
1 - pnorm(5.81) = 0 (no chance)
(d) Sketch the two distributions (population and sampling) on the same scale.
normalPlot(mean = 9000, sd = 1000)
normalPlot(mean = 9000, sd = 258)
(e) Could you estimate the probabilities from parts (a) and (c) if the lifespans of light bulbs had a skewed distribution?
No. The z values were based on the assumption of a normal distribution.
As the sample size increases the spread becomes narrower and the sd deviation becomes smaller. A smaller SD results in a larger z-score which decreases the p-value. That is, if the null hypothesis is true, as you increase the sample size, you stregthen the case that the null hypothesis is true (p-value decreases).