Posts

Showing posts from September, 2023

Module # 5 assignment

 Question #1 a.  Null Hypothesis (H0): The machine is producing cookies according to the manufacturer's specifications, with a mean breaking strength of 70 pounds. Alternative Hypothesis (Ha): The machine is not producing cookies according to the manufacturer's specifications, with a mean breaking strength different from 70 pounds. b.  a <- 70 s <- 3.5 n <- 49 xbar <- 69.1 z <- (xbar - a) / (s / sqrt(n)) p_value <- 2 * pnorm(-abs(z)) alpha <- 0.05 if (p_value < alpha) {   cat("Reject the null hypothesis. There is evidence that the machine is not meeting the manufacturer's specifications.\n") } else {   cat("Fail to reject the null hypothesis. There is no evidence that the machine is not meeting the manufacturer's specifications.\n") } c.  The computed p-value is the probability of observing a sample mean as extreme as 69.1 pounds, assuming the null hypothesis is true. If the p-value is less than the significance level (0.05), ...

Module #4 Probability Theory

 A1. P(A) = P(B) + P(B1) = 10 + 20 = 30  A2. P(B) = P(A) + P(A1) = 10 + 20 = 30  A3. P(A or B) = P(A) + P(B) - P(A and B)          P(A and B) = 10          P (A or B) = P(A) + P(B) - P(A and B) = 30 + 30 - 10 = 50          Therefore, the probability of Event A or B is 50%.  A4. P(A or B) = P(A) + P(B)          P(A or B) = 30 + 30 = 60        Therefore, P(A or B) is 60%.    B1. True B2.  The answer is true because it is based on the application of Bayes' theorem. In this case, the question is asking for the probability that it will rain on the day of Jane's wedding (Event A1) given the weatherman's prediction of rain (Event B).  The calculation correctly takes into account the probabilities of it raining (P(A1)) and not raining (P(A2)), as well as the conditional probabilities of the weatherman correctly predic...

Module # 3 assignment

First, let's create the data sets Set#1 and Set#2: set1 <- c(10, 2, 3, 2, 4, 2, 5) set2 <- c(20, 12, 13, 12, 14, 12, 15)   Now, let's calculate the measures of central tendency for each set: # Mean for Set#1 and Set#2 mean_set1 <- mean(set1) mean_set2 <- mean(set2)   # Median for Set#1 and Set#2 median_set1 <- median(set1) median_set2 <- median(set2)   # Mode for Set#1 and Set#2 mode_set1 <- as.numeric(names(sort(table(set1), decreasing = TRUE)[1])) mode_set2 <- as.numeric(names(sort(table(set2), decreasing = TRUE)[1]))   Now, let's calculate the measures of variation for each set:   # Range for Set#1 and Set#2 range_set1 <- range(set1) range_set2 <- range(set2)   # Interquartile Range (IQR) for Set#1 and Set#2 iqr_set1 <- IQR(set1) iqr_set2 <- IQR(set2)   # Variance for Set#1 and Set#2 variance_set1 <- var(set1) variance_set2 <- var(set2)   # S...
 The result is 15. The myMean function takes an input vector assignment2, which is the dataset you provided. Inside the function, it uses the sum function to calculate the sum of all the values in assignment2 and then divides that sum by the length of assignment2 to compute the mean (average) of the dataset. The result will be printed to the console.