It has been claimed from previous studies that the average diameter of ball bearings from this manufacturing process is 2.30 cm. Based on the sample
It has been claimed from previous studies that the average diameter of ball bearings from this manufacturing process is 2.30 cm. Based on the sample of 50 that you collected, is there evidence to suggest that the average diameter is greater than 2.30 cm? Perform a hypothesis test for the population mean at alpha = 0.01.
In your initial post, address the following items:
Define the null and alternative hypothesis for this test in mathematical terms and in words.
Report the level of significance.
Include the test statistic and the P-value. See Step 3 in the Python script. (Note that Python methods return two-tailed P-values. You must report the correct P-value based on the alternative hypothesis.)
Provide your conclusion and interpretation of the results. Should the null hypothesis be rejected? Why or why not?
import pandas as pd import numpy as np import math import scipy . stats as st # create 50 randomly chosen values from a Normal distribution. (arbitrarily using mean=2. 48 and standard deviation=0.5 0 ) . diameters = np. random. normal (2 . 4800 , 0.500,50) # convert the array into a dataframe with the column name "diameters" using pandas library. diameters_df = pd. DataFrame (diameters, columns=[ ' diameters' ]) diameters_df = diameters_df . round(2) # print the dataframe (note that the index of dataframe starts at 0). print ( "Diameters data frame\ " ) print (diameters_df) Diameters data frame diameters 2. 72 2. 60 1 . 82 2. 73 1.93 2. 13 2.37 3 . 08 1.95 3. 05 10 2 . 74 11 2 . 23 12 2 . 36 13 2 .21 14 3. 34 2. 50 2.56 17 1.63 18 2 . 26 19 2 .43 20 2. 07 21 2 . 20 2.34 23 2. 03 24 2. 28 25 2. 04 26 2. 09 27 1. 77 28 3.37 29 2. 16 30 3. 05 31 1.50 2 . 77 33 3. 10 34 2.94 35 2 . 10 36 2 .60 37 2. 52 38 2 . 58 39 2 . 76 40 3. 15 41 2. 59 42 2.52 43 2.91 44 1.32 45 2. 69 46 2. 59 47 3.05 48 3.26 10 2. 24Step 2: Constructing confidence intervals You will assume that the population standard deviation is known and that the sample size is sufficiently large. Then you will use the Normal distribution to construct these confidence intervals. You will use the submodule scipy.stats to construct confidence intervals using your sample data. Click the block of code below and hit the Run button above. # Python methods that calculate confidence intervals require the sample mean and the standard error as inputs. # calculate the sample mean mean = diameters_df [ 'diameters' ] .mean ( ) # input the population standard deviation, which was given in Step 1. std_deviation = 0.5000 # calculate standard error = standard deviation / sqrt (n) where n is the sample size. stderr = std_deviation/math . sqrt (len (diameters_df [ ' diameters' ]) ) # construct a 908 confidence interval. conf_int_90 = st. norm. interval(0.90, mean, stderr) print ( "90% confidence interval (unrounded) =", conf_int_90) print ( "90% confidence interval (rounded) = (", round(conf_int_90[0], 2) , ", ", round(conf_int_90[1], 2), ")") print("") # construct a 998 confidence interval. conf_int_99 = st . norm. interval (0.99, mean, stderr) print ("998 confidence interval (unrounded) =", conf_int_99) print( "99% confidence interval (rounded) = (", round(conf_int_99[0], 2), ", ", round(conf_int_99[1], 2), ")") 90% confidence interval (unrounded) = (2. 3482912846323325, 2.5809087153676673) 90% confidence interval (rounded) = ( 2.35 , 2.58 ) 998 confidence interval (unrounded) = (2. 2824613632281547, 2. 646738636771845) 99% confidence interval (rounded) = ( 2.28 , 2.65 ) Step 3: Performing hypothesis testing for the population mean Since you were given the population standard deviation in Step 1 and the sample size is sufficiently large, you can use the z-test for population means. The z- test method in statsmodels.stats. w dels.stats.weightstats submodule runs the z-test. The input to this method is the sample dataframe and the value under the null hypothesis. The output is the test-statistic and the two-tailed P-value. Click the block of code below and hit the Run button above. from statsmodels . stats . weightstats import ztest # run z-test hypothesis test for population mean. The value under the null hypothesis is 2.30. test_statistic, p_value = ztest (x1 = diameters_df[ 'diameters'], value = 2.30) print ( "z-test hypothesis test for population mean") print ( "test-statistic =", round(test_statistic, 2) ) print( "two tailed p-value =" , round(p_value, 4) ) z-test hypothesis test for population mean test-statistic = 2.43 two tailed p-value = 0. 0149
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance