Question

Question (2) [5 marks] (Use R) Suppose you have a company producing cupcakes. Each cupcake is...

Question (2) [5 marks] (Use R) Suppose you have a company producing cupcakes. Each cupcake is supposed to contain 10 grams of sugar. The cupcakes are produced by a machine that adds the sugar in a bowl before mixing everything. You believe the machine does not add 10 grams of sugar for each cupcake. If your assumption is true, the machine needs to be fixed. You stored the level of sugar of thirty cupcakes. Note: You can create a randomized vector with the function rnorm(). This function generates normally distributed values.

The basic syntax is: rnorm(n, mean, sd) arguments - n: Number of observations to generate - mean: The mean of the distribution. Optional (you can put what you want) - sd: The standard deviation of the distribution.

Optional Note: Why we are using set.seed?. Set the seed of R's random number generator, which is useful for creating simulations or random objects that can be reproduced. The random numbers are the same, and they would continue to be the same no matter how far out in the sequence we went.

a) [1 mark] Generate 30 observations from a Normal distribution with a mean of 9 and a standard deviation of 0.02. Set the seed to 123. Note: Show the R code that you used to generate the dataset and only the first 6 observations from the dataset (output).

b) [1 mark] State the hypothesis to check whether the level of sugar is different than the recipe (You can use either symbols or words).

c) [1 mark] Use a suitable test using R to check your hypothesis in (b), use a significance level (α) of 0.05. Note: Show the R code and the result/output of the hypothesis test.

d) [2 marks] Interpret your finding in (c). Note: State the degree of freedom (0.5 mark), interpret the hypothesis you are testing (interpret statistically and relating to the topic of interest) (1 mark) and interpret the confidence interval (0.5 mark). Note: Interpret the hypothesis statistically means: is it statistically significant or not?

Homework Answers

Answer #1

Que.a

> set.seed(123)
> x=rnorm(30,9,0.02)
> head(x)
[1] 8.988790 8.995396 9.031174 9.001410 9.002586 9.034301

Que.b

Hypothesis:

Que.c

t.test(x,mu=10)

One Sample t-test

data: x
t = -279.42, df = 29, p-value < 2.2e-16
alternative hypothesis: true mean is not equal to 10
95 percent confidence interval:
8.991731 9.006384
sample estimates:
mean of x
8.999058

Que.d

Test statistic, t = -279.42

Degrees of freedom = 29

p value < 2.2e-16

Since p-value is less than 0.05, we reject null hypothesis and conclude that mean sugar content in cupcake is significantly different than 10.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches...
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches per box, with σ = 10. A random sample of 94 matchboxes shows the average number of matches per box to be 42.9. Using a 1% level of significance, can you say that the average number of matches per box is more than 40? What are we testing in this problem? single proportionsingle mean     What is the level of significance? State the null and...
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches...
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches per box, with σ = 7. A random sample of 92 matchboxes shows the average number of matches per box to be 42.7. Using a 1% level of significance, can you say that the average number of matches per box is more than 40? What are we testing in this problem? single mean single proportion (a) What is the level of significance? State the...
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches...
The Nero Match Company sells matchboxes that are supposed to have an average of 40 matches per box, with σ = 8. A random sample of 96 matchboxes shows the average number of matches per box to be 42.5. Using a 1% level of significance, can you say that the average number of matches per box is more than 40? What are we testing in this problem? A.) single mean B.) single proportion      (a) What is the level of significance?...
For this problem, you will have to report your answers in the boxes provided. Each question...
For this problem, you will have to report your answers in the boxes provided. Each question has its own instructions. Read carefully and follow the instructions as stated for each question to ensure that you get full credit. If you fail to follow these instructions, the computer would mark you wrong. Report your answers in the boxes in the same order the questions are listed in the problem. Question number matches up the box number. E.g. Question 1 matches up...
Question 1 Suppose the average height of American adult males is 5 feet 10 inches (70...
Question 1 Suppose the average height of American adult males is 5 feet 10 inches (70 inches) and the standard deviation is 5 inches. If we randomly sample 100 men: What will the expected value of the average height of that sample be? (i.e. the mean of the sampling distribution) What will the standard deviation of the average height in that sample be? (i.e. the standard deviation of the sampling distribution) How big of a sample would we need to...
R Code Directions: All work has to be your own, you may not work in groups....
R Code Directions: All work has to be your own, you may not work in groups. Show all work. Submit your solutions in a pdf document on Moodle. Include your R code (which must be commented and properly indented) in the pdf file. Name this pdf file ‘your last name’-HW5.pdf. Also submit one text file with your R code, which must be commented and properly indented. You may only use ‘runif’ to generate random numbers; other random number generating functions...