Chapter 4 Foundations for Inference
Graded: 4.4, 4.14, 4.24, 4.26, 4.34, 4.40, 4.48
4.4 (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).) The mean for height of active individual is 171.1 The median is 170.3
The standard deviation is 9.4 The IQR = Q3-Q1
#IQR = Q3-Q1
IQR= 177.8-163.8
IQR
## [1] 14
library(ggplot2)
meanHeight <- 171.1
sdHeight <- 9.4
x <- 180
zTall <- (x - meanHeight) / sdHeight
pTall <- pnorm(zTall, lower.tail = TRUE)
pTall
## [1] 0.8281318
library(ggplot2)
meanHeight <- 171.1
sdHeight <- 9.4
x <- 155
zshort <- (x - meanHeight) / sdHeight
pshort <- pnorm(zshort, lower.tail = TRUE)
pshort
## [1] 0.0433778
The random sample of physically individual does not be expected to be ones given mean and standard deviation, because the random of sample taken are different from the sample size, location taken, proportion between male and female are also the factor to determine the mean and standard deviation.
Standard error of sample mean= standard deviation divided by the square root of sample size standard deviation is 9.4 sample size is 507
#SE= sd / sqrt of sample n
SE <- 9.4 / sqrt(507)
SE
## [1] 0.4174687
174 P.208 4.14 Thanksgiving spending n=436 mean = 84.71 point estimate ± 1.96 x SE = 80.31 , 89.11
False, the 95% confident interval is calculating the plausible range of values for the population parameter, not for sample size.
False, the sample size is 436 larger than 30, a larger sample size can compensate for the right skewed.
Partially true, because it is 95% confident interval that population mean is in the interval and the sample mean has some variability around the population mean which can be qualified using the standard deviation of the distribution of sample means.
True, it is 95% confident interval that population mean is in the interval.
True, 90% confidence interval would be narrower than 95%, it mean it would be lower confidence.
False, margin of error = zSE = z(s/sqrt(n)), if confidence interval to be a third, it need 9 times larger.
True, the margin of error is 4.4
me<- (89.11-80.31)/2
me
## [1] 4.4
P.211 4.24 Gifted children
Sample size n = 36 min = 21 mean = 30.69 sd = 4.31 max = 39
Are conditions for inference satisfied? The distribution is not over skewed. It is bimodal distribution, the sample size is larger than 30, but only 36, if it is more sample size, it will be well approximated by a normal model.
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 fist count to 10 successfully is less than the general average of 32 months. Use a significance level of 0.10.
Null hypothesis (H0>=32): H0: u=32
H1: u<32
u<-32
smean<-30.69
sd<-4.31
n<-36
#standard error = se
se<-sd/sqrt(n)
se
## [1] 0.7183333
#calc z
z<-abs(qnorm(0.05))
#z=(x-u)/se
x<-u-(z*se)
x
## [1] 30.81845
Rejection region is x<30.8, and sample mean 30.69 is smaller than 30.8 at rejected region, we reject the null hypothesis, so we can prove alternative hypothesis u<32 which is true.
P-value is 0.034, because the p-value is less thqn the significance level of 0.10, the hypotheiss is implausible. We reject the null hypothesis and concluded that gifted children first count to 10 successfully is less than general average of 32 months.
sd<-4.31
n<-36
#P-value=P(x<30.69)=P(Z<(30.69-32)/(sd/sqrt(n))
value<-((30.69-32)/(sd/sqrt(n)))
pvalue <- pnorm(value, lower.tail = TRUE)
pvalue
## [1] 0.0341013
When the population mean is assummed as 32, the probability of less than 30.69 P(x<30.69) is 0.034, so the probability of null hypothesis is very low and rejected.
mean<-30.69
sd<-4.31
n<-36
#standard error = se
se<-sd/sqrt(n)
se
## [1] 0.7183333
#30.69 +/- (z-score for 90% confidence interval * se)
#30.69 +/- (1.645 * 0.72) = (29.51, 31.87)
z<-abs(qnorm(0.05))
z
## [1] 1.644854
lowervalue <- mean - (z * se)
uppervalue <- mean + (z * se)
lowervalue
## [1] 29.50845
uppervalue
## [1] 31.87155
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.
Null hypothesis (H0<=100): H0: u=100 H1: u>100 significance level = 0.10
n<-36
samplemean<-118.2
sd<-6.5
se<-sd/(sqrt(n))
zmean<-(samplemean-100)/se
#upper-tail:
pvalue <- 1-pnorm(zmean)
pvalue
## [1] 0
The probability of sample mean - 118.2 is 0, and is less than significance value - 0.10, we reject the null hypothesis and their IQ is greater than general population.
samplemean<-118.2
sd<-6.5
n<-36
#standard error = se
se<-sd/sqrt(n)
#118.2 +/- (z-score for 90% confidence interval * se)
#118.2 +/- (1.645 * 0.72)
z<-abs(qnorm(0.05))
lowervalue <- samplemean - (z * se)
uppervalue <- samplemean + (z * se)
lowervalue
## [1] 116.4181
uppervalue
## [1] 119.9819
Population mean of 100 is outside the 90% confidence interval.
Both reject the null hypothesis, the probability of sample mean - 118.2 is 0, and is less than significance value - 0.10, we reject the null hypothesis and their IQ is greater than general population and the population mean of 100 is outside the 90% confidence interval.
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 central limit theorem is the assumption of normality inherent within a relatively non-skewed distribution, having more than 30 independent samples.
It then factors the law of large numbers, which says that as we increase samples beyond the minimum theshold, we calibrate our sample mean, sd, se closer the the real, or population equivalents.
This is what the confidence interval statistically approximates. These statistical analyses are referred to as the sampling distribution of the 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.
sd<-1000
n<-9000
z<-(10500-n)/sd
pnorm(z, lower.tail =FALSE)
## [1] 0.0668072
sd<-1000
n<-9000
z<-(10500-n)/sd
pnorm(z, lower.tail =FALSE)
## [1] 0.0668072
sd<-1000
n<-9000
se<-1000/sqrt(15)
z1<-(10500-n)/se
pnorm(z1, lower.tail =FALSE)
## [1] 3.133452e-09
mean<-9000
sd<-1000
se<-1000/sqrt(15)
normsample <- seq(mean - (5 * sd), mean + (5 * sd), length=5)
randomsample<- seq(mean - (5 * se), mean + (5 * se), length=5)
hnorm <- dnorm(normsample,mean,sd)
hrandom<- dnorm(randomsample,mean,se)
plot(normsample, hnorm, type="l",col="yellow",
xlab="Lightbulb Population vs Sampling",
ylab="",main="Distribution (population and sampling)", ylim=c(0,0.002))
lines(randomsample, hrandom, col="blue")
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.
standard error=standard deviation/square(sample size) Zscore=sample mean-population mean / standard error
The standard error decreases, the z-score increases, and therefore the p value will decrease.