Processing math: 100%

I created std error function

std_err <- function(deviation,n){
    standard_error <- deviation/(sqrt(n))
    return(standard_error)
}
std_err(1.75,110)
## [1] 0.166856
std_err(4.15,52)
## [1] 0.5755015
 a <- 7.42
 s <- 1.75
 n <- 110
 error <- qt(0.975,df=n-1)*s/sqrt(n)
 left <- a-error
 right <- a+error
 print(paste(left,":", right))
## [1] "7.08929692545117 : 7.75070307454883"

4.4

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

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

171.1-9.4
## [1] 161.7
180.5-161.7
## [1] 18.8

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.

small <- 171.1-155
tall <- 180-171.1
paste(small/9.4, tall/9.4, sep=" /")
## [1] "1.71276595744681 /0.946808510638298"

D. The mean and the deviation wouldn’t be exactly the same due to randomization which is why we build confidence intervals to determine if a change in the mean is simply do to chance or can be attributed to an external factor.

E. We use the standard error

answer 0.4174687

std_err <- function(deviation,n){
    standard_error <- deviation/(sqrt(n))
    return(standard_error)
}
print(std_err(9.4,507))
## [1] 0.4174687

4.14

A. We are 95% confident that the average spending of these 436 American adults is between $80.31 and $89.11. + False the average spending of this group is the mean which is 84.71

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

C. 95% of random samples have a sample mean between $80.31 and $89.11.

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

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.

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.

std_err <- function(deviation,n){
    standard_error <- deviation/(sqrt(n))
    return(standard_error)
}
print(std_err(9.4,436))
## [1] 0.4501784
sample_mean <- (89.11-80.31)/2
sample_mean <-  84.71
std_err_now <- (89.11-80.31)/4
std_err_now <- 2.2

## new std_err must be 3 size
tehnical_std_deviation <- 2.2*sqrt(436)
print(std_err(45.9,436))
## [1] 2.198211
print(std_err(45.9,1308))
## [1] 1.269138
1.27*4
## [1] 5.08

G. The margin of error is 4.4.

4.24

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 fist count to 10 successfully is less than the general average of 32 months. Use a significance level of 0.10.

H~O: the difference between the average time a gifted child and a normal child counts to 10 successfully is 0 H~A: the difference between the average time a gifted child and a normal child counts to 10 successfully is >0

actual_diff <- 32-30.69
z <- 1.645
n <- 36
my_val <- std_err(4.31,36)
my_z <- actual_diff/my_val
my_p <- 1- .9656

paste("Answer: since my pscore:",my_p,"is less than:",.10," We can reject the null hypothesis with a significance level of .10")
## [1] "Answer: since my pscore: 0.0344 is less than: 0.1  We can reject the null hypothesis with a significance level of .10"

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

D. Calculate a 90% confidence interval for the average age at which gifted children first count to 10 successfully.

my_ster <-  std_err(4.31,36)
paste(30.69-my_ster,"-",30.69+my_ster)
## [1] "29.9716666666667 - 31.4083333333333"
  1. Do your results from the hypothesis test and the confidence interval agree? Explain

4.26

  1. Perform a hypothesis test to evaluate if these data provide convincing evidence that the average IQ of mothers of gifted children is di↵erent than the average IQ for the population at large, which is 100. Use a significance level of 0.10.

H~O: the difference between the average iq of mothers of gifted children and the population at large = 0 H~A: the difference between the average iq of mothers of gifted children and the population at large != 0

actual_diff <- 118.2-100
z <- 1.645
n <- 36
my_val <- std_err(6.5,36)
my_z <- actual_diff/my_val
my_p <- .0002*2
#I dont know the p at this z level is but its two tailed so it needs to be muuliplyed by 2 
  1. Calculate a 90% confidence interval for the average IQ of mothers of gifted children.
my_ster <-  std_err(6.5,36)
paste(118.2-my_ster,"-",118.2+my_ster)
## [1] "117.116666666667 - 119.283333333333"

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

4.34

4.40

  1. What is the probability that a randomly chosen light bulb lasts more than 10,500 hours?
diff <- 10500-9000
z_score <- diff/1000

Answer 6.7%

B Describe the distribution of the mean lifespan of 15 light bulbs.

std_err(1000,15)
## [1] 258.1989
9000+1.96*(258)
## [1] 9505.68
9000-1.96*(258)
## [1] 8494.32
pnorm(5.81)
## [1] 1
  1. What is the probability that the mean lifespan of 15 randomly chosen light bulbs is more than 10,500 hours?
.067^15
## [1] 2.461059e-18
  1. Sketch the two distributions (population and sampling) on the same scale.
library('DATA606') 

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?

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

actual_diff <- 32-30.69
z <- 1.645
n <- 36
my_val <- std_err(10,50)


my_val_2 <- std_err(10,500)

paste(my_val,my_val_2,sep=" turns into ")
## [1] "1.41421356237309 turns into 0.447213595499958"