I could not download ‘DATA606’ package as it is not compatible with the last version of R. I have manually taken function normalPlot() from the package. source: https://github.com/jbryer/DATA606/blob/master/R/normalPlot.R

normalPlot <- function(mean=0, sd=1, bounds=c(-1,1), tails=FALSE) {
  x <- seq(-4,4,length=100)*sd + mean
  hx <- dnorm(x,mean,sd)
  
  plot(x, hx, type="n", xlab="x-Axis", ylab="",
       main="Normal Distribution", axes=FALSE)
  lines(x, hx)
  
  if(tails) {
    i.low <- x <= bounds[1]
    i.high <- x >= bounds[2]
    polygon(c(x[i.low],bounds[1]), c(hx[i.low], 0), col="red")
    polygon(c(bounds[2],x[i.high]), c(0,hx[i.high]), col="red")
  } else {
    i <- x >= bounds[1] & x <= bounds[2]
    polygon(c(bounds[1],x[i],bounds[2]), c(0,hx[i],0), col="red")
    area <- pnorm(bounds[2], mean, sd) - pnorm(bounds[1], mean, sd)
    if(diff(bounds) > 0) {
      result <- paste("P(",bounds[1],"< x <",bounds[2],") =",
                      signif(area, digits=3))
      mtext(result,3)
    }
  }
  axis(1)
}

# normalPlot(mean = 0, sd = 1, bounds = c(-1.13, 4))

4.4 Heights of adults.

  1. What is the point estimate for the average height of active individuals? What about the median?

The point estimate for the average height of active individuals is 171.1.

The median is 170.3.

As data is normally distributed with not many outliers it is better to use mean.

  1. What is the point estimate for the standard deviation of the heights of active individuals? What about the IQR?

The point estimate for the standard deviation height of active individuals is 9.4.

The point estimate for the IQR height of active individuals is IQR = Q3 - Q1 = 177.8−163.8 = 14.

  1. 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.

Person can be considered unusually tall or short if person height would be more than +2 or -2 standard deviations from the mean.

Solution for 180

x <- 180
mu <- 171.1
sd<- 9.4
z <- (x - mu)/sd
z
## [1] 0.9468085

180cm is 0.94 standard deviation away from the mean, this is less than 2 standard deviation. Person with height of 180cm can not be considered as unusually tall.

Another solution:

+2 standard deviation away from mean is 189.9cm. From that height person can be considered unusually tall. 180cm is less than 189.9, that’s why person can not be considered unusually tall.

180>(171.1+ 2*9.4)
## [1] FALSE

Solution for 155

x <- 155
mu <- 171.1
sd<- 9.4
z <-(x - mu)/sd
z
## [1] -1.712766

155cm is |-1.7| standard deviation away from the mean, this is less than |-2| standard deviation. Person with height of 155 cm can not be considered as unusually short.

Another solution:

-2 standard deviation away from mean is 152.3cm. From that height person can be considered unusually short. 155cm is more than 152.3cm, that’s why person can not be considered unusually short.

155<(171.1+ 2*(-9.4))
## [1] FALSE
  1. 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.

If the population hight is normally distributed,samples were taken randomly and sample sizes are the same then mean and standard deviation will be similar, not identical. 95.4% probability that samples mean fall within 2 standard deviation from the population mean. The larger sample the smaller standard deviation.

  1. 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 SDx ̄ = pn )? Compute this quantity using the data from the original sample under the condition that the data are a simple random sample.
n <- 507
SE <- sd/sqrt(n)
SE
## [1] 0.4174687

4.2%

4.14 Thanksgiving spending, Part I

  1. FALSE - We are 95% confident that the average spending of these 436 American adults is between $80.31 and $89.11.

As confidence interval and confidence level should be applied to the estimation of the population mean, not sample mean. As with the sample mean we are 100% sure about the sample mean as we have all data to calculate it.

  1. FALSE - This confidence interval is not valid since the distribution of spending in the sample is right skewed.

The distribution is slightly right skewed so it can be tolerated taking into the account that sample is quite large.

  1. FALSE - 95% of random samples have a sample mean between $80.31 and $89.11.

We are 95% confident that the average spending of all American adults is between $80.31 and $89.11.

  1. TRUE - We are 95% confident that the average spending of all American adults is between $80.31 and $89.11.

  2. TRUE - A 90% confidence interval would be narrower than the 95% confidence interval, hence we will be less sure about our estimates.

  3. FALSE - 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.

We need to increse a sample size by 3 times 2 which is 9 (from the margin of error formula).

  1. TRUE - The margin of error is 4.4

The margin of error = confidence interval/2

(89.11-80.31)/2
## [1] 4.4

4.24 Gifted children, Part I.

  1. Are conditions for inference satisfied?

It seems that condition are satisfied because:

  1. The data are randomly sampled
  2. The sample dats is likely independent
  3. The sample size is 36 children which should be under 10% of the population as it is a big city.
  4. Data is nearly normally distributed with no obvious skewness.
  1. 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.

H0: μ>=32 months

H1: μ<32 months

x <- 32
n <- 36
mean <- 30.69
sd <- 4.31
se <- sd/sqrt(n)
z = (x-mean)/se
p = 1-pnorm(z)
p 
## [1] 0.0341013

We have enough evidence to reject the null hypethesis because p is less than significance level and we accept the alternative hypethesis.

  1. Interpret the p-value in context of the hypothesis test and the data.

P-value is the probability of finding any result under the test conditions for a given set of data presuming that the null hypothesis were true. The p-value has to be smaller than the significance level because that gives us an indication that the probability of that result happening is very low.

The probability that gifted childred first count to 10 at the age of 32 months and up is so low (less than significance level of 0.1) that we can reject that hypotesis (H0).

  1. Calculate a 90% confidence interval for the average age at which gifted children first count to 10 successfully.
LowerTail <- mean - 1.645 * se
UpperTail <- mean + 1.645 * se
LowerTail
## [1] 29.50834
UpperTail
## [1] 31.87166

The 90% confidence interval is between 29.5 and 31.9

  1. Do your results from the hypothesis test and the confidence interval agree? Explain.

We are 90% confident that the average age at which gifted child first count to 10 is between 29.5 and 31.9 months and it is lower than the average age for ordnary children ( 32 months and up). Results agree.

4.26 Gifted children, Part II.

  1. 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.

H0: μ<=100 H1: μ>100

x <- 100
n <- 36
mean <- 118.2
sd <- 6.5
se <- sd/sqrt(n)
z = (x-mean)/se
p = pnorm(z)
p 
## [1] 1.22022e-63

p < 0.1, we can reject the H0 hypotesis and accept the alternative one. The average IQ of mothers of gifted children is higher than the average IQ of mothers of ordinary children.

  1. Calculate a 90% confidence interval for the average IQ of mothers of gifted children.
LowerTail <- mean - 1.645 * se
UpperTail <- mean + 1.645 * se
LowerTail
## [1] 116.4179
UpperTail
## [1] 119.9821
  1. Do your results from the hypothesis test and the confidence interval agree? Explain.

We are 90% confident that the average IQ of mothers of gifted children is between 116.4 abd 120 which is higher than 100. Results agreed.

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.

“sampling distribution” of the mean means is a theoretical distribution of the values that the mean of a sample takes on in all of the possible samples of a specific size that can be made from a given population. The central limit theorem states that if you have a population with mean μ and standard deviation σ and take sufficiently large random samples from the population with replacement , then the distribution of the sample means will be approximately normally distributed. As the sample size increases the distribution will have better normally distributed shape, spread will be smaller and the center will be closer to the population mean.

4.40

  1. What is the probability that a randomly chosen light bulb lasts more than 10,500 hours?
1 - pnorm(10500, 9000, 1000)
## [1] 0.0668072
  1. Describe the distribution of the mean lifespan of 15 light bulbs.

The sample of 15 light bulbs has only one mean. It is not appropriate to talk about the distribution of one mean.

  1. What is the probability that the mean lifespan of 15 randomly chosen light bulbs is more than 10,500 hours?
x = 10500
mean = 9000
sd<-1000
SE<-sd/sqrt(15)
Z <- (x - mean)/258
p <- 1 - pnorm(Z) 
p
## [1] 3.050719e-09

The probability is close to 0.

  1. Sketch the two distributions (population and sampling) on the same scale.
par(mfrow = c(1,2))
x <- 6000:12000
mean1 = 9000
sd1 = 1000
mean2 = 9000
sd2 = 1000/sqrt(15)
y1 <- dnorm(x, mean1, sd1)
y2 <- dnorm(x, mean2, sd2)
plot(x,y1,col="red")
plot(x,y2,col="black")

  1. Could you estimate the probabilities from parts (a) and (c) if the lifespans of light bulbs had a skewed distribution?

If it is slightly skewed - yes, otherwise we have to have larger sample.

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.

As sample size increase, the standard error decrease. Hence Z score will increase and p-value will decrease. Increasing sample size makes the hypothesis test more sensitive - more likely to reject the null hypothesis when it is, in fact, false. Thus, it increases the power of the test.