Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Homework: For each question write your R statements and the answer. Describe wit

ID: 3327062 • Letter: H

Question

Homework: For each question write your R statements and the answer. Describe with few words whether you accept/ reject null hypothesis 1. Generate 25 random numbers between a and b. represents last two digits of your student number 03 b:represents first two digits of your student number20 Let le 2+b/2, your null hypothesis will be 'gle, write your alternative hypothesis and level of significance. Will you reject or accept null hypothesis? 2. A biologist was interested in determining whether sunflower seedlings treated with an extract from Vinca minor roots resulted in a lower average height of sunflower seedlings than the standard height of 15.7 cm. The biologist treated a random sample of n 30 seedlings with the extract and subsequently obtained the following heights: 19.0 12.8 12.8 19.2 13.1 14.4 16.7 15.7 13.5 10.5 15.1 15.1 17.3 13.3 13.5 Write your alternative hypothesis and level of significance. Using R, carry out the test and calculate the power of the test. Wil you reject or accept null hypothesis? 3. An electrical firm manufactures light bulbs that have a lifetime that is approximately normally distributed with a mean of 800 hours and a standard deviation of 40 hours. Test the hypothesis that ·800 hours against the alternative, 800 hours, if a random sample of 30 bulbs has an average life of 788 hours. Use a P-value in your answer

Explanation / Answer

Question 1

Solution:

Required R codes for the given scenario are summarised as below:

> A = c(runif(25,3,20))

> a = 3

> b = 20

> mu0 = (a + b)/2

> t.test(A,mu = mu0)

#R Output

        One Sample t-test

data: A

t = -0.491, df = 24, p-value = 0.6279

alternative hypothesis: true mean is not equal to 11.5

95 percent confidence interval:

8.763883 13.184460

sample estimates:

mean of x

10.97417

Here, we get P-value = 0.6279 > level of significance = = 0.05, so we do not reject the null hypothesis that true mean is equal to 11.5.

There is sufficient evidence to conclude that true mean is 11.5.

Question 2

Required R codes are given as below:

> Height = c(11.9,11.8,15.7,16.5,14.6,10.5,15.1,19.0,12.8,12.8,19.2,13.1,16.6,13.5,14.4,16.7,10.9,13.0,15.1,17.3,13.3,12.4,8.5,14.3,12.9,11.1,15.0,13.3,15.8,13.5)

> mu0 = 15.7

> t.test(Height,mu=mu0,alternative = "less")

#R output:

        One Sample t-test

data: Height

t = -3.7665, df = 29, p-value = 0.0003756

alternative hypothesis: true mean is less than 15.7

95 percent confidence interval:

     -Inf 14.77788

sample estimates:

mean of x

    14.02

#Here, we get p-value < level of significance = = 0.05, so we reject the null hypothesis.

#There is sufficient evidence to conclude that true mean is less than 15.7.

#R codes for power of the test are given as below:

> mean = 14.02

> mu0 = 15.7

> delta = mean - mu0

> n = 30

> sig.level = 0.05

> power.t.test(n,delta,sd,sig.level,NULL,type="one.sample", alternative = "one.sided")

#R output:

     One-sample t test power calculation

              n = 30

          delta = -1.68

             sd = 2.443062

      sig.level = 0.05

          power = 4.977269e-08

    alternative = one.sided

#Power is very less and it is approximately equal to zero.

Question 3

Required R codes are given as below:

#One tailed Z test

> mu = 800

> sigma = 40

> n = 30

> xbar = 788

> z = (xbar - mu)/(sigma/sqrt(n))

> p-value = pnorm(z)

> Pvalue = pnorm(z)

> Pvalue

[1] 0.05017412

# We do not reject the null hypothesis H0 because P-value > = 0.05

#Two tailed Z test

> mu = 800

> sigma = 40

> n = 30

> xbar = 788

> z = (xbar - mu)/(sigma/sqrt(n))

> Pvalue = 2*pnorm(z)

> Pvalue

[1] 0.1003482

# We do not reject the null hypothesis H0 because P-value > = 0.05