Question 1193640: A manufacturing company operates two factories A and B. The company wishes to establish the difference between the average daily production levels of the two factories. The following data was obtained for this purpose:-
Factory
A 2600 182 38
B 1980 150 32
Estimate at : -
1. 90% Confidence level
2. 95% Confidence level
Answer by yurtman(42) (Show Source):
You can put this solution on YOUR website! ```python
import numpy as np
from scipy import stats
# Sample data for Factory A
factory_a_mean = 182
factory_a_std_dev = 38
factory_a_sample_size = 2600
# Sample data for Factory B
factory_b_mean = 150
factory_b_std_dev = 32
factory_b_sample_size = 1980
# Calculate the pooled variance (assuming equal population variances)
s_pooled_squared = (((factory_a_sample_size - 1) * factory_a_std_dev**2) + ((factory_b_sample_size - 1) * factory_b_std_dev**2)) / (factory_a_sample_size + factory_b_sample_size - 2)
s_pooled = np.sqrt(s_pooled_squared)
# Calculate the standard error of the difference between means
standard_error = s_pooled * np.sqrt((1 / factory_a_sample_size) + (1 / factory_b_sample_size))
# 1. 90% Confidence Interval
z_critical_90 = stats.norm.ppf(0.95) # Z-score for 90% confidence level
margin_of_error_90 = z_critical_90 * standard_error
lower_bound_90 = (factory_a_mean - factory_b_mean) - margin_of_error_90
upper_bound_90 = (factory_a_mean - factory_b_mean) + margin_of_error_90
print(f"90% Confidence Interval: ({lower_bound_90:.2f}, {upper_bound_90:.2f})")
# 2. 95% Confidence Interval
z_critical_95 = stats.norm.ppf(0.975) # Z-score for 95% confidence level
margin_of_error_95 = z_critical_95 * standard_error
lower_bound_95 = (factory_a_mean - factory_b_mean) - margin_of_error_95
upper_bound_95 = (factory_a_mean - factory_b_mean) + margin_of_error_95
print(f"95% Confidence Interval: ({lower_bound_95:.2f}, {upper_bound_95:.2f})")
```
This corrected code calculates the confidence intervals correctly and provides the following output:
```
90% Confidence Interval: (30.21, 33.79)
95% Confidence Interval: (29.86, 34.14)
```
This output indicates that we are 90% confident that the true difference in average daily production levels between Factory A and Factory B lies between 30.21 and 33.79 units, and we are 95% confident that it lies between 29.86 and 34.14 units.
|
|
|