Hypothesis Testing

Homework Week 3 Hypothesis testing

 

Don't use plagiarized sources. Get Your Custom Essay on
Hypothesis Testing
Just from $13/Page
Order Essay

Question 1. Test the hypothesis

H0: μ=500

H1: μ≠500

Using the evidence �̅� = 530, s=90 from a sample of n=100, at a significance level of 1%.

 

Question 2. You buy cars for a car rental company, and want to buy 20 new cars for the fleet.

Phoning round 64 car dealers, the mean quoted price for the 20 cars is £250,000 with a sample

standard deviation of £750. The best price you have been quoted is £2500 below the sample mean.

a) Should you take this offer or spend more time looking?

b) Determine the answer using a p-value. At what significance level would you reject the Null

hypothesis?

 

Question 3. A commonly used drug for treating COVID-19 is believed to be only 60% effective.

Experimental trials with a new drug administered to 100 affected adults showed that 70%

experienced less severe long COVID symptoms. Is the new drug more effective than the previous

one?

 

 

R questions

Question 1. This is an example how to create a function in R which performs a two-sided hypothesis

test of means in large samples

##Function for two-tailed hypothesis test in large samples

set.seed(9) z.hyptest.twotail = function(muhyp,n,xbar,s,alpha) {

zstar = qnorm(1-alpha/2) SE = s/sqrt(n) teststat = (xbar-muhyp)/SE p = 1-pnorm(teststat) print(“critical value:”) print(zstar) print(“test statistic:”) print(teststat) print(“p-value:”) print(p) if ((teststat>=-zstar) & (teststat<=zstar)) { print (“do not reject H0”) } else {

print (“reject H0”)

 

 

} }

a. Test the hypothesis from seminar question 1 again using R

b. Now create a RV x from a sample with n=1000, drawn from a population with mean 530 and

standard deviation 90, and adapt the function to test the hypothesis that the population mean is

525. What do you decide?

c. Now create a new RV y with n=35, drawn from a population with mean 530 and standard

deviation 90. Test the hypothesis that the population mean is 525 again.

d. Create a function that performs one-sided hypothesis tests of means (again, by varying the

function defined at the beginning)

e. Draw a sample of n=64 from a population with mean 25000 and standard deviation 750. Test the

one-sided hypothesis in seminar question 2 again. What do you decide? Is this the correct

decision or are you making an error? If yes, which type of error?

ORDER NOW »»

and taste our undisputed quality.