A number of yarns have been spun from wool/rayon blend, with different proportion of the two components. 6 different variants have been manufactured, and for each variant a total of 8 measurements of the yarn strength have been made in [cN]. The results have been summarized in Table.
Determine whether the change in the proportion of the components has an influence on the yarn strength.
Proportion of components |
|||||
40/60 |
45/55 |
50/50 |
55/45 |
60/40 |
65/35 |
100 |
93 |
101 |
127 |
111 |
69 |
141 |
120 |
87 |
83 |
84 |
86 |
147 |
123 |
88 |
80 |
83 |
80 |
126 |
105 |
105 |
87 |
96 |
82 |
133 |
109 |
93 |
96 |
83 |
80 |
101 |
103 |
102 |
109 |
90 |
99 |
148 |
130 |
73 |
68 |
101 |
81 |
128 |
143 |
94 |
97 |
64 |
71 |
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.DataFrame({
'proportion': ['40/60', '40/60', '40/60', '40/60', '40/60', '40/60', '40/60', '40/60', '45/55', '45/55', '45/55', '45/55', '45/55', '45/55', '45/55', '45/55', '50/50', '50/50', '50/50', '50/50', '50/50', '50/50', '50/50', '50/50', '55/45', '55/45', '55/45', '55/45', '55/45', '55/45', '55/45', '55/45', '60/40', '60/40', '60/40', '60/40', '60/40', '60/40', '60/40', '60/40', '65/35', '65/35', '65/35', '65/35', '65/35', '65/35', '65/35', '65/35'],
'strength': [100, 141, 147, 126, 133, 101, 148, 128, 93, 120, 123, 105, 109, 103, 130, 143, 101, 87, 88, 105, 93, 102, 73, 94, 127, 83, 80, 87, 96, 109, 68, 97, 111, 84, 83, 96, 83, 90, 101, 64, 69, 86, 80, 82, 80, 99, 81, 71]})
model = ols('strength ~ proportion', data=df).fit()
sm.stats.anova_lm(model, typ=1)
df | sum_sq | mean_sq | F | PR(>F) | |
---|---|---|---|---|---|
proportion | 5.0 | 12869.75 | 2573.950000 | 11.449167 | 5.219617e-07 |
Residual | 42.0 | 9442.25 | 224.815476 | NaN | NaN |
А sweater is produced on three different machines. The table below shows the number of defective sweaters produced in the last six months. Тhe table also shows that every month a different operator works with the machines. Determine whether the different number of defective sweaters is due to the type of machine or the operator.
Machine 1 | Machine 2 | Machine 3 | |
Operator 1 | 75 | 75 | 90 |
Operator 2 | 70 | 70 | 70 |
Operator 3 | 50 | 55 | 75 |
Operator 4 | 65 | 60 | 85 |
Operator 5 | 80 | 65 | 80 |
Operator 6 | 65 | 65 | 65 |
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.DataFrame({
'operator': ['Operator 1', 'Operator 2', 'Operator 3', 'Operator 4', 'Operator 5', 'Operator 6', 'Operator 1', 'Operator 2', 'Operator 3', 'Operator 4', 'Operator 5', 'Operator 6', 'Operator 1', 'Operator 2', 'Operator 3', 'Operator 4', 'Operator 5', 'Operator 6'],
'machine': ['Machine 1', 'Machine 1', 'Machine 1', 'Machine 1', 'Machine 1', 'Machine 1', 'Machine 2', 'Machine 2', 'Machine 2', 'Machine 2', 'Machine 2', 'Machine 2', 'Machine 3', 'Machine 3', 'Machine 3', 'Machine 3', 'Machine 3', 'Machine 3'],
'defectives': [75, 70, 50, 65, 80, 65, 75, 70, 55, 60, 65, 65, 90, 70, 75, 85, 80, 65]})
model = ols('defectives ~ operator + machine', data=df).fit()
sm.stats.anova_lm(model, typ=1)
df | sum_sq | mean_sq | F | PR(>F) | |
---|---|---|---|---|---|
operator | 5.0 | 750.0 | 150.0 | 3.157895 | 0.057399 |
machine | 2.0 | 525.0 | 262.5 | 5.526316 | 0.024181 |
Residual | 10.0 | 475.0 | 47.5 | NaN | NaN |
Study the influence of the needle number and the density of the seam on the strength of the seam in [N]. The study has been conducted with three different needle numbers: 70, 80 and 90. the density of the seam being 3, 4 and 5 stitches/cm. 5 tests have been conducted for each combination of the factors. The data from the measurements is given in the following table:
Density 3 | 70 Needles | 80 Needles | 90 Needles | Density 4 | 70 Needles | 80 Needles | 90 Needles | Density 5 | 70 Needles | 80 Needles | 90 Needles |
192.9 | 155.3 | 183.5 | 243.6 | 230.1 | 252.7 | 267.7 | 218.1 | 229.7 | |||
220.9 | 170.3 | 188.5 | 254 | 201.5 | 210 | 277.2 | 250.4 | 253.2 | |||
199.1 | 168.2 | 184.5 | 261.1 | 224.9 | 218 | 264.4 | 220.4 | 203.5 | |||
195.6 | 160.5 | 174.5 | 255.7 | 230.1 | 245.7 | 293.3 | 156 | 247.1 | |||
176 | 176.6 | 185.2 | 224.1 | 209.9 | 233.4 | 256.3 | 218.3 | 271.6 |
import pandas as pd
import statsmodels.api as sm
from statsmodels.formula.api import ols
df = pd.DataFrame({
'density': ['Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 3', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4', 'Density 4','Density 4', 'Density 4', 'Density 4', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5', 'Density 5'],
'needles': ['70 Needles', '70 Needles', '70 Needles', '70 Needles', '70 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles', '70 Needles', '70 Needles', '70 Needles', '70 Needles', '70 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles', '70 Needles', '70 Needles', '70 Needles', '70 Needles', '70 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '80 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles', '90 Needles'],
'strength': [192.9, 220.9, 199.1, 195.6, 176, 155.3, 170.3, 168.2, 160.5, 176.6, 183.5, 188.5, 184.5, 174.5, 185.2, 243.6, 254, 261.1, 255.7, 224.1, 230.1, 201.5, 224.9, 230.1, 209.9, 252.7, 210, 218, 245.7, 233.4, 267.7, 277.2, 264.4, 293.3, 256.3, 218.1, 250.4, 220.4, 156, 218.3, 229.7, 253.2, 203.5, 247.1, 271.6]})
model = ols('strength ~ density + needles + density:needles', data=df).fit()
sm.stats.anova_lm(model, typ=2)
sum_sq | df | F | PR(>F) | |
---|---|---|---|---|
density | 31157.852444 | 2.0 | 44.990762 | 1.614067e-10 |
needles | 11655.701778 | 2.0 | 16.830393 | 6.912805e-06 |
density:needles | 1486.102222 | 4.0 | 1.072938 | 3.841812e-01 |
Residual | 12465.700000 | 36.0 | NaN | NaN |