You are on page 1of 41

6th A MODULE

HYPOTHESIS TEST

LAB WORK OBJECTIVES

1. Students know and understand the differences in univariate and bivariate analysis.
2. Students know how to test and understand parametric statistics.
3. Students know and understand the tests used in parametric statistics.
4. Students capable of resolving a case related to parametric statistics.

LAB WORK TOOLS

1. Laptop / PC.
2. SIPO Lab work Module 2021.
3. Software Ms Excel.
4. Software R.
5. Software IBM SPSS Statistics.

LAB WORK STEP

UNIVARIATE ANALYSIS

A. Normality Test
Case study

ABC Company is a manufacturing company that produces alpha-type stirling


engines. In the production process, there is often a defect products. To evaluate the
improvement of product quality, the Quality Control Division recorded a defect
stirling engine for 30 weeks. The following is data on a defect stirling engine at
ABC Company for 30 weeks that can be seen in the table.
Table 8. 1 Case Study of Normality Test

Weeks Number of Defect Weeks Number of Defect


Striling Engine (units) Striling Engine (units)

1 11 16 20
2 12 17 15

3 6 18 19

4 16 19 13

5 15 20 5

6 19 21 6

7 11 22 16

8 20 23 5

9 12 24 13

10 17 25 7

11 10 26 7

12 18 27 8

13 15 28 9

14 12 29 12

15 11 30 20

From the data table, is the defect stirling engine data normally distributed? Use the
95% confidence level!

Solution Step

1. Open the Software R.


2. Then click on File → New File → R Script, to make a syntax in a new page.
Figure 8. 1 Create a New Page in Software R

3. Software R display to be as follows.

Figure 8. 2 Software R Display

4. After that, import data into the Software R with the following steps: File → Import
dataset → From Excel
Figure 8. 3 Import Files from Ms. Excel

5. Then click the Browse and find file Ms. Excel DATA MODULE 6A

Figure 8. 4 Import Excel‟s Display

6. In the Import Option, change Sheet from Default to Normality Test.


Figure 8. 5 Import Excel

7. Then click Import and the display of Software R will be as follows.

Figure 8. 6 Excel Data Display

8. To see the data that has been input in Software R can create syntax as shown below.
Figure 8. 7 Syntax to view Excel data

Where :

a) Mydata : Just to analogy the file name


b) Data.frame () : Function to create a data frame in a file call
c) () : Data.frame containing brackets in the file name Ms. Excel is
used as input
9. To make the Kolmogorov-Smirnov test can follow syntax as shown below.

Figure 8. 8 Output Normality Test

Where :

a) Ks : Just to analogy file name to be called


b) Breakdown Machine : The name of the column to be executed
Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : The defect stirling engine for 30 days has normal distribution

𝐻1 : The defect stirling engine for 30 days has not normal distribution
𝑋−𝜇
2. Test Statistic :𝑍 =
𝜎

𝐷 = |𝐹𝑠(𝑥) − 𝐹𝑡(𝑥 )|𝑚𝑎𝑥

3. α : 0.05
4. Criteria Test : Reject H0 if the p-value ≤ α

Do not reject H0 if the p-value > α

5. Decision : Do not reject H0, because the p-value (0.9705) > 0.05
6. Conclusion : Interpret the results

B. One Sample T-Test

Case study

DOTS Company is a manufacturing company that produces Beta-type stirling. The


marketing department kept track of selling Stirling Beta machines for 30 days can
be seen in the table below.

Table 8. 2 Case study of One Sample T-Test

Sales data of stirling Days Sales data of stirling


Days
engine (unit) engine (unit)

1 51 16 71

2 64 17 42

3 75 18 62

4 59 19 60

5 47 20 72
6 80 21 49

7 78 22 59

8 70 23 70

9 78 24 51

10 71 25 61

11 51 26 72

12 42 27 59

13 42 28 60

14 77 29 75

15 46 30 54

The marketing department said that the average sales of Stirling Beta machines for
30 days were 60 engine products. Perform a hypothesis test to test the correctness
of the statement from the marketing department of DOTS Company, and use a 95%
confidence level!

Solution Step

1. Open the Software R.


2. Then click on File → New File → R Script, to make a syntax in a new page.
Figure 8. 9 Create a New Page in Software R

3. Software R display to be as follows

Figure 8. 10 views on Software R

4. After that import data into the Software R with the following steps: File → Import
dataset → From Excel
Figure 8. 11 File Import from Excel

5. Then click the Browse and find file Ms. Excel DATA MODULE 6A

Figure 8. 12 Import Excel Display

6. In the Import Option, change Sheet from Default to One Sample T Test
Figure 8. 13 Choose Excel Sheet

7. Then click Import and display the Software R will be as follows.

Figure 8. 14 Excel Data Display

8. To see the data that has been input in Software R can create the following syntax.
Figure 8. 15 Syntax for the Excel Data View

9. To determine the value of t on Total Sales column can use the following syntax.

Figure 8. 16 Output One Sample T-Test

Where :

a) mu : The mean of total sales


b) Conf.level : Confidence level

10. To determine the value of alpha (α) on the One Sample T-Test can use the following
syntax.

Figure 8. 17 Syntax for Determining the Value of α One Sample T-Test


Where :

a) Df : The number of samples (n-1)

Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : The average sales data of stirling engine for 30 days is equal to 60 units

𝐻1 : The average sales data of stirling engine for 30 days is not equal to 60 units
/ – 1
2. Test Statistic : 𝑡 =
23

3. α : 0.05
4. Criteria Test : Reject H0 if t count is not at | t table | or p-value ≤ α

Do not reject H0 if t count is at | t table | or p-value > α

5. Decision : Do not reject H0, because the value of t = 0.7281 at interval of


-2.04523 < t < 2.04523 and p-value = (0.4724) > 0.05
6. Conclusion : Interpret the results

C. Independent Sample T-Test

Case study

Adidaya Company is a manufacturing company that produces two types of stirling,


namely Beta Stirling and Gamma Stirling. To face the challenges of the COVID-
19 pandemic, Adidaya Company's marketing department markets its products
through social advertising media, where beta stirling is through Youtube Ads and
Gamma Stirling through Facebook Ads. Sales data from Beta Stirling and Gamma
Stirling in June 2020 can be seen in the table below.
Table 8. 3 Case study of Independent Sample T-Test

Beta Stirling Gamma Stirling

60 67
40 52

84 96

66 75

98 64

87 48

85 53

30 78

68 83

75 60

115 89

67 85

55 99

94 71

77 54

88 100

91 76

55 93

73 48

29 41

Perform a hypothesis test to see if there is a difference in the average sales of Beta
Stirling products using Youtube Ads and the average sales of Gamma Stirling
products using Facebook Ads! Use the 95% confidence level and normally
distributed data!
Solution Step

1. Open Software applications R.


2. Then click File → New File → R Script, to make a syntax in a new page.

Figure 8. 18 Create a New Page in Software R

3. Software R display to be as follows.

Figure 8. 19 Software R Display

4. After that import data into the Software R with the following steps: File →
Import dataset → From Excel
Figure 8. 20 Import Files from Ms. Excel

5. Then click the Browse and find file Ms. Excel DATA MODULE 6A

Figure 8. 21 Import Excel Display

6. In the Import Option, change Sheet from Default to Independent Sample.


Figure 8. 22 Choose Excel sheet

7. Then click Import and the display of Software R will be as follows.

Figure 8. 23 Excel Data Display

8. To see the data that has been input in Software R can create the following
syntax.
Figure 8. 24 Syntax for the Excel Data View

9. Then define the column beta and gama stirling for simplicity can use the
following syntax.

Figure 8. 25 Defining Alpha and Beta Stirling

10. After the column has been defined, to determine the value of the data variance
can follow the syntax below.

Figure 8. 26 Determining the Variance Value Data


11. Then to determine the value of t and p-value to the independent sample t-tests
with alpha 0.05, using the following syntax.

Figure 8. 27 Output Independent Sample T-Test

Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : There is no difference in the average sales of stirling beta and gamma stirling

𝐻1 : There is a difference in the average sales of stirling beta and gamma stirling
45 6 47
2. Test Statistics : 𝑡 =
97 7
9
8 5 ; 7
:5 :7

3. α : 0.05
4. Criteria Test : Reject H0 if t count is not at | t table | or p-value ≤ α
Do not reject H0 if t count is at | t table | or p-value > α
5. Decision : Do not reject H0, because the value of t count = 0.03825 is in
the interval -2.024394 <t <2.024394 and p-value (0.9697) > 0.05
6. Conclusion : Interpret the results
D. Paired Sample T-Test
Case study

The increase in fuel prices caused a number of raw materials for making stirling
engines to also increase. To respond to these conditions, Barutama Company was
forced to increase the selling price of the Sirling Engine by 3% from the previous
selling price. The table on the side is data on demand for Stirling Engine products
before the increase and after the selling price increase.
Table 8. 4 Case study Paired Sample T-Test

Demand Before Selling Demand After Selling


Price Increase Price Increase

39 71

62 70

38 40

46 52

69 60

57 62

55 44

62 59

76 36

49 58

52 52

42 64

73 35

81 48
79 63

By testing the hypothesis, is the average of the Stirling Engine demand data before
the selling price increase the same as the average of the Stirling Engine demand
data after the selling price increase? Use the 95% confidence level if the data is
known to be normally distributed!

Solution Step

1. Open Software applications R.


2. Then click File → New File → R Script, to make a syntax in a new page.

Figure 8. 28 Create a New Page in Software R

3. Software R display to be as follows.


Figure 8. 29 Views on Software R

4. After that import data into the Software R with the following steps: File → Import
dataset → From Excel

Figure 8. 30 File Import from Excel

5. Then click the Browse and find file Ms. Excel DATA MODULE 6A
Figure 8. 31 Import Excel Display

6. In the Import Option, change Sheet from Default to Paired Sample T Test.

Figure 8. 32 Choose Excel sheet

7. Then click Import and display the Software R will be as follows.


Figure 8. 33 Excel Data Display

8. To see the data that has been input in Software R can create the following syntax.

Figure 8. 34 Syntax for the Excel Data View

9. Then define Demand Before Selling Price Increase and Demand After Selling
Price Increase to become more simple use the following syntax.

Figure 8. 35 Defining the Software R


10. To determine the value of t and p-value in the Paired Sample T-Test with an alpha
of 0.05 can use the following syntax.

Figure 8. 36 Output Paired Sample T-Test

Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : The average of the demand data before the selling price increase and
after the selling price increase is the same

𝐻1 : The mean of the data before the selling price increase and after the
selling price increase is not the same

45 6 47
2. Test Statistic : 𝑡 =
9 7 97
8 5 ; 7 6=>? 95 @? 97 @
<5 <7 <5 <7

3. α :0.05

4. Criteria Test : Reject H0 if t count is not at | t table | or p-value ≤ α

Do not reject H0 if t count is at | t table | or p-value > α

5. Decision : Do not reject H0, because the value of t count = 0.82128 is in


the range of -2.144787 <t < 2.144787 and the p-value (0.4253) > 0.05
6. Conclusion : Interpret the results.
ANALYSIS BIVARIATE

A. Pearson correlation

Case study

A test was carried out by the quality control department at ABC Company to
determine the relationship between the intensity of sunlight and the rotational speed
of the stirling engine. The following is the data of sunlight intensity with rotational
speed.
Table 8. 5 Case Study of Pearson Correlation

Intensity (W/m2) Rotating Speed (Rpm)

755 117

800 129

834 126

851 139

940 144

775 120

834 127

865 138

920 142

960 149

Perform hypothesis testing with a 95% confidence level if the data is known to have
been normally distributed!
Solution Step

1. Open IBM SPSS software Stastistics.


2. Click the Data View and enter the data will be calculated. Charging can be done
as follows.

Figure 8. 37 Pearson Correlation Data

3. Click the Variable View and change the name of each variable into Intensity and
Rotating Speed, as well as change the Measure in two columns into Scale. Then
change Decimals on Rotating Speed to 5 as follows.

Figure 8. 38 Change Data on Variable View

4. Then click Analyze → Correlate → Bivariate, After that, the dialog box will
appear Bivariate Correlation. Input Intensity and Rotating Speed into Variables
column as below. Then checklist Pearson in Correlation Coefficients choice and
click on the Two-tailed in Test of Significance and checklist at Flag Significant
Correlations.
Figure 8. 39 Dialog Box: Bivariate Correlation

5. Click Options, and then select Exclude cases listwise in Missing Values. Then
click Continue → OK.

Figure 8. 40 Dialog Box Bivariate Correlation: Options

6. IBM SPSS output

Figure 8. 41 Output Bivariate Correlation


Analysis and Testing Hypotheses

1. Hypothesis
𝐻0 : There is no relationship between sunlight intensity and
rotational speed
𝐻1 : There is a relationship between sunlight intensity and
rotational speed
B∑ 4DED6(∑ 4D)(ED)
2. Test Statistic : 𝑟 = ; − 1 ≤ 𝑟 ≤ 1
H[B ∑ 4D 7 6(∑ 4D)7][B ∑ ED 7 6(∑ ED)7 ]

3. α : 0.05
4. Criteria Test : Reject H0 if the p-value ≤ α

Do not reject H0 if the p-value > α

5. Decision : Reject H0, because the p-value (0.000) ≤ 0.05


6. Conclusion : Interpret the results

B. Partial Correlation

Case study

SIPO STEEL wants to conduct research on the steel plate coating process. The
research was conducted to see the relationship between the hardness of the steel
layer, the duration of the coating process, and the temperature treatment. The
researcher made questions based on two variables, namely the hardness of the steel
layer, the duration of the coating process, and the temperature treatment control
variables.

Table 8. 6 Case study Partial Correlation

Hardness Steel Duration of Temperature


Layer (VHN) Coating (menit) Treatment (°C)
162 17 44,2

182 24 49

234 34 47,9

153 16 43,4

185 26 49,5

392 37 48,4

173 18 45,7

147 14 43,1

197 30 51,2

179 19 46,6

The use of a research significance of 5% to test the hypothesis!

Solution Step

1. Open IBM SPSS software Stastistics.


2. Click the Data View and enter the data will be calculated. Charging can be done
as follows.

Figure 8. 42 Data View Partial Correlation


3. Click the Variable View and change the name of each variable, and change the
Measure in three columns into the Scale as follows.

Figure 8. 43 Change Measure in Variable View

4. Click Analyze → Correlate → Partial, and then the dialog box will appear Partial
Correlation. Input Hardness_Steel_Layer and Duration_Coating into Variables
column. Then enter the Temperature_ Treatment of Controlling for the following
column.

Figure 8. 44 Dialog Box Partial Correlation

5. Click Options, then select Zero-Order Correlation and select Exclude cases
listwise. Then click Continue → OK.
Figure 8. 45 Dialog Box Partial Correlation: Option

6. IBM SPSS output.

Figure 8. 46 Output Partial Correlation

Analysis and Testing Hypotheses

1. Hyptothesis

𝐻0 : There is no significant relationship between Coating Duration and Hardness


of steel layers, if the temperature treatment is constant

𝐻1 : There is a significant relationship between Coating Duration and Steel Layer


Hardness, if the temperature treatment is constan
B∑ 4E6?∑ 4@(∑E)
2. Test Statistic : 𝑟 =
H[B ∑ 4²6(∑ 4)7][B ∑ E²6(∑ E)7]

𝑟𝑦𝑥₁ − 𝑟𝑦𝑥₂ . 𝑟𝑥₁𝑥₂


𝑟𝑦. 𝑥₁ − 𝑥₂ =
T1 − 𝑟²𝑦𝑥₂ T1 − 𝑟 = 𝑥₁𝑥₂

3. α : 0.05
4. Criteria Test : Reject H0 if the p-value ≤ α

Do not reject H0 if the p-value > α

5. Decision : Reject H0, because the p-value is (0.003) ≤ 0.05


6. Conclusion : Interpret the results

C. Linear regression

Case study

SIPO Company has researched the conversion of sunlight as a heat source in


Stirling engines. To determine the performance of the Stirling engine, two variables
were measured, namely the difference in reservoir temperature and the
measurement of the Stirling engine rotational speed.

Table 6. 7 Case study Linier Regression

Reservoir Temperature Rotating Speed Rpm


ΔT ( °C) (Rad/s)

157,41 885

142,28 796

141,99 810

158,85 808

142,94 773

149,42 825

158,56 863
128,29 784

178,95 884

156,04 806

196,98 898

138,69 835

146,78 821

166,50 850

128,35 775

Is there an effect of temperature differences on the rotation produced by the Stirling


engine. Use a research significance of 5% to test this hypothesis!

Solution Step

1. Open IBM SPSS software Stastistics.


2. Click the Data View and enter the data will be calculated. Charging can be done
as follows.

Figure 8. 47 Linear Regression Data View


3. Click the Variable View and change the name of each variable, and change the
Measure in two columns into Scale.

Figure 8. 48 Change Measure in Variable View

4. Click Analyze → Regression → Linear, Then will come the Linear Regression
dialog box. Enter Reservoir_Temperature to Independent variables, while
Rotating_Speed into the Dependent as shown below.

Figure 8. 49 Dialog Box Linear Regression

5. Then click Statistics, select Estimates and Model fit on Regression Coefficients.
Then click Continue.
Figure 8. 50 Dialog Box Linear Regression: Statistics

6. Then click Plots, and enter SDRESID into column Y, then enter ZPRED into
column X. Then check the Histogram and Normal probability plot on
Standardized Residual Plots. Then click Continue.

Figure 8. 51 Dialog Box Linear Regression: Plot

7. Click Save, and then select the box Standardized Residuals. Then click Continue.

Figure 8. 52 Linear Regression dialog box: Save


8. Then click Options, and then fill in the dialog box corresponding to the picture
below.

Figure 8. 53 Linear Regression dialog box: Options

In the picture above, the Stepping Method Criteria option is used the F Test with an
Entry of 0.05. Then checklist Include constant in the equation, and the Missing
Values select Exclude cases listwise. Click Continue then Ok.
9. IBM SPSS output.
a. Outlier test

Figure 8. 54 Outlier Test Output

Outlier Test can be seen from the value of the minimum and maximum of Std. Residual.

b. Normality test

Figure 8. 55 Output Normality Test

In the histogram curve approaching the normal curve for a perfect bell-shaped seta
based p-residual plots, scattered data obtained diagonal line approach. It shows the data
passed the test of normality or can be used to more accurately test K-S.
c. Heterocedasity Test

Figure 8. 56 Output Heterocedasity Test

Based on the scatterplot, the data does not form a certain pattern and spreads along the
positive Y and negative Y axes, it can be concluded that heteroscedasticity does not
occur.

d. Correlation

Figure 8. 57 Output Correlation

Based on the results of SPSS output table summary models obtained correlation value
(R) is 0,819. It showed a strong correlation between temperature and rotational speed
difference stirling.
e. F test

Figure 8. 58 Output Test F

Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : The existing regression models are not appropriate to use.

𝐻1 : The existing regression models are appropriate to use.


U7 ∑ (/6/)
2. Test Statistic :𝐹 = VW 7

3. α : 0.05
4. Criteria Test : Reject H0 if the p-value ≤ α

Do not reject H0 if the p-value > α

5. Decision : Reject H0, because the p-value (0.000) ≤ 0.05


6. Conclusion : Interpret the results.
f. T Test

Figure 8. 59 Output T Test

Analysis and Testing Hypotheses

1. Hypothesis

𝐻0 : The independent variable has no significant effect on the regression coefficient

𝐻1 : The independent variable has a significant effect on the regression coefficient


U6YZ
2. Test Statistic : 𝑡X = 2[

3. α : 0.05
4. Criteria Test : Reject H0 if the p-value ≤ α

Do not reject H0 if the p-value > α

5. Decision : Reject H0, because the p-value (0.000) ≤ 0.05


6. Conclusion : Interpret the results

You might also like