delivery_times <- c(32, 28, 30, 29, 31, 35, 33, 27, 29, 28, 30, 34, 31, 29, 30)
t_test <- t.test(delivery_times, mu = 30)
t_test
##
## One Sample t-test
##
## data: delivery_times
## t = 0.67566, df = 14, p-value = 0.5103
## alternative hypothesis: true mean is not equal to 30
## 95 percent confidence interval:
## 29.13026 31.66974
## sample estimates:
## mean of x
## 30.4
The t-statistic is 0.67566 The p-value is 0.5103, which is greater than the significance level of 0.05 The 95% confidence interval for the mean delivery time is between 29.13 and 31.67 minutes. The sample mean is 30.4 minutes.
Since the p-value (0.5103) is greater than 0.05, We fail to reject the null hypothesis. This means that the sample data does not provide sufficient evidence to say that the true mean delivery time is different from 30 minutes. Also, the 95% confidence interval (29.13 to 31.67) includes 30, which further supports that the delivery time is not significantly different from 30 minutes.
Based on this test, I can conclude that there is no significant difference between the sample mean and the claimed mean of 30 minutes.
traditional_scores <- c(78, 85, 88, 92, 76, 80, 84, 75, 83, 89)
new_method_scores <- c(90, 88, 85, 93, 95, 87, 84, 91, 92, 90)
t_test <- t.test(traditional_scores, new_method_scores, var.equal = TRUE)
t_test
##
## Two Sample t-test
##
## data: traditional_scores and new_method_scores
## t = -3.066, df = 18, p-value = 0.006656
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
## -10.953977 -2.046023
## sample estimates:
## mean of x mean of y
## 83.0 89.5
t-statistic: −3.066 Degrees of freedom: 18 p-value: 0.006656 95% Confidence Interval: [−10.95,−2.05] Mean of Traditional Method: 83.0 Mean of New Method: 89.5
Since the p-value (0.006656) is less than the significance level of 0.05, we reject the null hypothesis. This indicates that there is a significant difference in the test scores between the students taught with the traditional method and those taught with the new method.
Additionally, the 95% confidence interval for the difference in means ([−10.95,−2.05]) does not contain 0, which further supports the conclusion that the difference in means is statistically significant.
Based on the test results, I can conclude that the new teaching method has a statistically significant impact on test scores. The students who were taught using the new method performed better than those taught using the traditional method.
weights_before <- c(70, 82, 85, 90, 88, 76, 95, 78, 84, 72, 80, 86)
weights_after <- c(68, 80, 83, 85, 86, 74, 90, 76, 82, 70, 78, 85)
t_test <- t.test(weights_before, weights_after, paired = TRUE)
t_test
##
## Paired t-test
##
## data: weights_before and weights_after
## t = 6.7507, df = 11, p-value = 3.155e-05
## alternative hypothesis: true mean difference is not equal to 0
## 95 percent confidence interval:
## 1.628737 3.204597
## sample estimates:
## mean difference
## 2.416667
t-statistic: 6.7507 Degrees of freedom: 11 p-value: 3.155×10−5
95% Confidence Interval: [1.6287,3.2046] Mean Difference: 2.4167
Since the p-value (3.155×10−5) is much smaller than the significance level of 0.05, we reject the null hypothesis. This indicates that there is a statistically significant difference in the weights of the participants before and after following the diet. The 95% confidence interval for the mean difference in weights ([1.6287,3.2046]) does not contain 0, which further supports the conclusion that there is a significant change in weight.
Based on the results of the paired t-test, I can conclude that the diet has a statistically significant effect on weight loss. On average, participants lost around 2.42 kilograms, indicating the diet was effective in reducing weight.
set.seed(123)
sample_scores <- rnorm(30, mean = 505, sd = 50)
t_test <- t.test(sample_scores, mu = 500)
t_test
##
## One Sample t-test
##
## data: sample_scores
## t = 0.29533, df = 29, p-value = 0.7698
## alternative hypothesis: true mean is not equal to 500
## 95 percent confidence interval:
## 484.3287 520.9610
## sample estimates:
## mean of x
## 502.6448
Since the p-value (0.7698) is greater than the significance level of 0.05, we fail to reject the null hypothesis. This indicates that there is no statistically significant difference between the sample mean and the hypothesized population mean of 500.
The 95% confidence interval for the mean score ([484.3287, 520.9610]) contains the value 500, which further supports the conclusion that the sample mean is not significantly different from the hypothesized population mean.
Based on the test results, we can conclude that there is no evidence to suggest that the average score of players differs from 500. The sample mean of 502.64 is not significantly different from the hypothesized mean of 500, and the results suggest that the players’ average scores are in line with the expected value.
sample_mean <- 9.5
sample_sd <- 1.2
n <- 50
population_mean <- 10
z_stat <- (sample_mean - population_mean) / (sample_sd / sqrt(n))
p_value <- 2 * pnorm(-abs(z_stat))
z_stat
## [1] -2.946278
p_value
## [1] 0.003216229
Since the p-value (0.003216229) is less than the significance level of 0.05, we reject the null hypothesis. This indicates that there is sufficient evidence to conclude that the actual mean battery life is significantly different from the claimed 10 hours.
Based on the results of the one-sample z-test, we can conclude that the average battery life of the phones is significantly different from the claimed 10 hours. The sample mean of 9.5 hours is statistically lower than the claimed value, suggesting that the battery life is, on average, less than 10 hours.
n1 <- 80
mean1 <- 75
sd1 <- 10
n2 <- 100
mean2 <- 78
sd2 <- 8
z_stat <- (mean1 - mean2) / sqrt((sd1^2 / n1) + (sd2^2 / n2))
p_value <- 2 * pnorm(-abs(z_stat))
z_stat
## [1] -2.182179
p_value
## [1] 0.02909633
Since the p-value (0.0291) is less than the significance level of 0.05, we reject the null hypothesis. This indicates that there is a statistically significant difference in the average exam scores between students from School A and School B.
Based on the results of the two-sample z-test, we can conclude that the average exam scores at School A and School B are significantly different. The negative z-statistic suggests that the average score at School A is lower than at School B, with the observed difference being statistically significant.
observed_proportion <- 290 / 500
population_proportion <- 0.6
n <- 500
z_stat <- (observed_proportion - population_proportion) /
sqrt((population_proportion * (1 - population_proportion)) / n)
p_value <- 2 * pnorm(-abs(z_stat))
z_stat
## [1] -0.9128709
p_value
## [1] 0.3613104
Since the p-value (0.3613) is greater than the significance level of 0.05, we fail to reject the null hypothesis. This indicates that there is no statistically significant difference between the observed proportion of adults preferring online shopping and the claimed population proportion of 60%.
Based on the results of the one-sample z-test, we conclude that the preference for online shopping in the sample is not significantly different from the claimed 60%. The observed proportion of 58% does not provide enough evidence to refute the claim that 60% of adults prefer online shopping.
x1 <- 250
n1 <- 1000
x2 <- 320
n2 <- 1200
p1 <- x1 / n1
p2 <- x2 / n2
p_combined <- (x1 + x2) / (n1 + n2)
z_stat <- (p1 - p2) / sqrt(p_combined * (1 - p_combined) * ((1 / n1) + (1 / n2)))
p_value <- 2 * pnorm(-abs(z_stat))
z_stat
## [1] -0.8884224
p_value
## [1] 0.3743136
Since the p-value (0.3743) is greater than the significance level of 0.05, we fail to reject the null hypothesis. This indicates that there is no statistically significant difference in the proportion of people using public transportation between City X and City Y.
Based on the results of the two-sample z-test, we conclude that the proportion of people using public transportation in City X and City Y is not significantly different. The p-value suggests that the observed difference in proportions is likely due to random chance and does not provide sufficient evidence to claim a meaningful difference between the two cities.
only_breast <- c(794.1, 716.9, 993.0, 724.7, 760.9, 908.2, 659.3, 690.8, 768.7,
717.3, 630.7, 729.5, 714.1, 810.3, 583.5, 679.9, 865.1)
only_formula <- c(898.8, 881.2, 940.2, 966.2, 957.5, 1061.7, 1046.2, 980.4,
895.6, 919.7, 1074.1, 952.5, 796.3, 859.6, 871.1, 1047.5,
919.1, 1160.5, 996.9)
both <- c(976.4, 656.4, 861.2, 706.8, 718.5, 717.1, 759.8, 894.6, 867.6, 805.6,
765.4, 800.3, 789.9, 875.3, 740.0, 799.4, 790.3, 795.2, 823.6, 818.7,
926.8, 791.7, 948.3)
group <- factor(rep(c("Breast", "Formula", "Both"),
c(length(only_breast), length(only_formula), length(both))))
weight_gain <- c(only_breast, only_formula, both)
data <- data.frame(weight_gain, group)
anova_result <- aov(weight_gain ~ group, data = data)
summary(anova_result)
## Df Sum Sq Mean Sq F value Pr(>F)
## group 2 429014 214507 26.7 7.19e-09 ***
## Residuals 56 449881 8034
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Since the p-value (7.19e-09) is significantly less than the significance level of 0.05, we reject the null hypothesis. This indicates that there is a statistically significant difference in the average monthly weight gain between the three groups: exclusively breastfed children, children fed with only formula, and children fed with both breast milk and formula.
Based on the results of the ANOVA test, we conclude that the type of formula consumed (breast milk, formula, or both) has a significant effect on the average monthly weight gain of babies. Since the null hypothesis was rejected, further analysis would be needed to determine which specific groups differ from one another in terms of their weight gain.
data <- matrix(c(53, 23, 30, 36, 88, 71, 48, 51, 57, 203),
nrow = 2,
byrow = TRUE,
dimnames = list(Gender = c("Female", "Male"),
RiskAppetite = c("Very Low", "Low", "Medium", "High", "Very High")))
chi_squared_test <- chisq.test(data)
print(chi_squared_test)
##
## Pearson's Chi-squared test
##
## data: data
## X-squared = 7.0942, df = 4, p-value = 0.131
Since the p-value (0.131) is greater than the significance level (α = 0.01), we fail to reject the null hypothesis. This suggests that there is no statistically significant relationship between gender and risk appetite among the customers.
Based on the results of the Chi-Squared test, we conclude that the risk appetite of customers in this company is independent of their gender. There is no sufficient evidence to suggest a significant association between these two variables.