Question

In: Statistics and Probability

Please use R program and explain clealry please. thank you. 1. In NZ supermarkets, the average...

Please use R program and explain clealry please. thank you.

1. In NZ supermarkets, the average weight of a banana is 120 grams. An agricultural scientist buys bananas from a supermarket. Their weight, in grams, is as follows: c(103.2, 95.2, 89.6, 98.5, 112.8, 111) She suspects that this sample of bananas is lighter than average and wonders if this supermarket is selling bananas that are lighter than the NZ average.

(a) State a sensible null hypothesis

(b) State the precise definition of p-value and explain what “more extreme” means in this context

(c) Perform a student t-test using R and interpret

(c) Perform a Z test and account for any differences you find

Solutions

Expert Solution

Attached is the R code marked in BOLD

# Test of Hypothesis
# Ho : mu=120 vs H1 : mu < 120
# x_bar = sample mean, s= sample standard deviation
# n = sample size
mu <- 120
x <- c(103.2, 95.2, 89.6, 98.5, 112.8, 111)
n <- length(x)
x_bar <- mean(x)
s <- sd(x)

# t=(x_bar-mu)/(s/sqrt(n)) ~ tn-1 under Ho
t <- (x_bar-mu)/(s/sqrt(n))
df <- n-1 # degree of freedom
# p_value of the tes
p_value <- pt(t, df, lower.tail = TRUE)
# alpha = level of significance 0.05
alpha <- 0.05
print(p_value)
if(p_value < alpha){
print("Reject Null Hypotheis")
} else {
print("Do not Reject Null Hypotheis")
}

Ans

p_value = 0.002160016

"Reject Null Hypotheis"

___________________________________________________________________________________________

Z- test code in R marked in BOLD

# z=(x_bar-mu)/(s/sqrt(n)) ~ N(0,1)under Ho
z <- (x_bar-mu)/(s/sqrt(n))
# p_value of the tes
p_value <- pnorm(z, mean = 0, sd = 1, lower.tail = TRUE)
# alpha = level of significance 0.05
alpha <- 0.05
print(p_value)
if(p_value < alpha){
print("Reject Null Hypotheis")
} else {
print("Do not Reject Null Hypotheis")
}

Ans

p_value = 3.895139e-07

"Reject Null Hypotheis"

The result is the same however the p-value is further reduced and more extreme


Related Solutions

Solve following using Program R studio. Please show code and results. Thank you. 1. Assume that...
Solve following using Program R studio. Please show code and results. Thank you. 1. Assume that ? is a random variable follows binomial probability distribution with parameters 15 and 0.25.   a. Simulate 100 binomial pseudorandom numbers from the given distribution (using set.seed(200)) and assign them to vector called binran. b. Calculate ?(? < 8) using cumulative probability function. c. Calculate ?(? = 8) using probability distribution function. d. Calculate the average of simulated data and compare it with the corresponding...
Please put Rcode and Routput. Thank you. 1. Use R to: (a)Find P(-1.45 < Z <...
Please put Rcode and Routput. Thank you. 1. Use R to: (a)Find P(-1.45 < Z < 2.72) b) Find P(Z < -2.24) (c) Find P( -1.34 < Z < - 0.74) d) Find P( 1.53 < Z) e) Find P( Z > 1.31) 2. Use R to: (a)Find z0 when P( - Z0 < Z < Z0)= 0.82 (b) Find z0 when P(Z > Z0)= 0.32 (c) Find z0 when P(Z < Z0)= 0.28 3. Use R: Suppose yearly income...
Please use R studio, Thank you. 2. The probability of a student passing statistics is known...
Please use R studio, Thank you. 2. The probability of a student passing statistics is known to be 0.41; and the probability of a student passing chemistry is known to be 0.55. If the probability of passing both is known to be 0.35, calculate: (a) the probability of passing at least one of statistics and chemistry (b) the probability of a student passing chemistry, given that they passed statistics (c) Are passing chemistry and statistics independent? Justify (d) (harder) a...
Solve following using Program R studio. Please show code and results. Thank you. 3. Assume that...
Solve following using Program R studio. Please show code and results. Thank you. 3. Assume that ? is a random variable represents lifetime of a certain type of battery which is exponentially distributed with mean 60 hours.   a. Simulate 500 pseudorandom numbers (using set.seed(10)) and assign them to a vector called expran. b. Calculate average of simulated data and compare it with corresponding theoretical value. c. Calculate probability that lifetime is less than 50 hours using cumulative probability function. d....
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a square root is achieved using the sqrt() function, but a warning will be issued when the argument is negative. Consider the following code which is designed to test whether a given value is positive before checking whether the square root of the value is less than 5. testValue <-7 (testValue > 0) & (sqrt(testValue) < 5) ## [1] TRUE testValue <--7 (testValue > 0)...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a...
Please answer the following by coding in R with comments ! Thank you!!! Evaluation of a square root is achieved using the sqrt() function, but a warning will be issued when the argument is negative. Consider the following code which is designed to test whether a given value is positive before checking whether the square root of the value is less than 5. testValue <-7 (testValue > 0) & (sqrt(testValue) < 5) ## [1] TRUE testValue <--7 (testValue > 0)...
PLEASE ANSWER J&K :) THANK YOU! 1. Q Corporation and R Inc. are two companies with...
PLEASE ANSWER J&K :) THANK YOU! 1. Q Corporation and R Inc. are two companies with very similar characteristics. The only difference between the two companies is that Q Corp. is an unlevered firm, and R Inc. is a levered firm with debt of $5 million and cost of debt of 10%. Both companies have earnings before interest and taxes (EBIT) of $2 million and a marginal corporate tax rate of 40%. Q Corp. has a cost of capital of...
PLEASE ANSWER J&K :) THANK YOU! 1. Q Corporation and R Inc. are two companies with...
PLEASE ANSWER J&K :) THANK YOU! 1. Q Corporation and R Inc. are two companies with very similar characteristics. The only difference between the two companies is that Q Corp. is an unlevered firm, and R Inc. is a levered firm with debt of $5 million and cost of debt of 10%. Both companies have earnings before interest and taxes (EBIT) of $2 million and a marginal corporate tax rate of 40%. Q Corp. has a cost of capital of...
I need to update this program to follow the these requirements please and thank you :...
I need to update this program to follow the these requirements please and thank you : Do not use packages Every class but the main routine class must have a toString method . The toString method for Quadrilateral should display its fields: 4 Points. All instance variables should be declared explicitly private . Area incorrect : enter points no: 1 1 3 enter points no: 2 6 3 enter points no: 3 0 0 enter points no: 4 5 0...
Please prove this and explain each step. Thank you. Use logical reasoning to solve the following...
Please prove this and explain each step. Thank you. Use logical reasoning to solve the following puzzle: Five friends disagree on whether to play video games or basketball. Either Alice or Bob, or both, want to play video games. Cindy and Don disagree on what they want to play. If Ellen plays video games, then so does Cindy. Alice and Don will play the same game. If Bob plays video games, then so do Alice and Ellen. Who is playing...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT