@@ -13,11 +13,11 @@ class MontgomerySpec < SpcSpec
13
13
end
14
14
15
15
describe "Flow Width example" do
16
- instrument_id = 1
16
+ id_instrument = 1
17
17
18
18
describe "x̄R rules" do
19
19
subject do
20
- DB [ :x_bar_r_rules ] . where ( instrument_id :)
20
+ DB [ :x_bar_r_rules ] . where ( id_instrument :)
21
21
end
22
22
23
23
it_has_params ( mean : 1.506 , upper : 1.693 , lower : 1.318 )
@@ -29,7 +29,7 @@ class MontgomerySpec < SpcSpec
29
29
30
30
describe "R̄ rules" do
31
31
subject do
32
- DB [ :r_rules ] . where ( instrument_id :)
32
+ DB [ :r_rules ] . where ( id_instrument :)
33
33
end
34
34
35
35
it_has_params ( mean : 0.32521 , upper : 0.68749 , lower : 0 )
@@ -39,11 +39,11 @@ class MontgomerySpec < SpcSpec
39
39
end
40
40
41
41
describe "Engine Piston Diameter example" do
42
- instrument_id = 2
42
+ id_instrument = 2
43
43
44
44
describe "x̄s rules" do
45
45
subject do
46
- DB [ :x_bar_s_rules ] . where ( instrument_id :)
46
+ DB [ :x_bar_s_rules ] . where ( id_instrument :)
47
47
end
48
48
49
49
it_has_params ( mean : 74.001 , upper : 74.014 , lower : 73.988 )
@@ -53,7 +53,7 @@ class MontgomerySpec < SpcSpec
53
53
54
54
describe "s̄ rules" do
55
55
subject do
56
- DB [ :s_rules ] . where ( instrument_id :)
56
+ DB [ :s_rules ] . where ( id_instrument :)
57
57
end
58
58
59
59
it_has_params ( mean : 0.0094 , upper : 0.0196 , lower : 0 )
@@ -63,11 +63,11 @@ class MontgomerySpec < SpcSpec
63
63
end
64
64
65
65
describe "Orange Juice Can Inspection" do
66
- instrument_id = 3
66
+ id_instrument = 3
67
67
68
68
describe "p non-conformant rules" do
69
69
subject do
70
- DB [ :p_non_conformant_rules ] . where ( instrument_id :)
70
+ DB [ :p_non_conformant_rules ] . where ( id_instrument :)
71
71
end
72
72
73
73
it_has_params ( mean : 0.2313 , upper : 0.4102 , lower : 0.0524 )
@@ -79,7 +79,7 @@ class MontgomerySpec < SpcSpec
79
79
80
80
describe "np non-conformant rules" do
81
81
subject do
82
- DB [ :np_non_conformant_rules ] . where ( instrument_id :)
82
+ DB [ :np_non_conformant_rules ] . where ( id_instrument :)
83
83
end
84
84
85
85
it_has_params ( mean : 11.565 , upper : 20.510 , lower : 2.620 )
@@ -91,11 +91,11 @@ class MontgomerySpec < SpcSpec
91
91
end
92
92
93
93
describe "Printed Circuit Boards" do
94
- instrument_id = 4
94
+ id_instrument = 4
95
95
96
96
describe "c rules" do
97
97
subject do
98
- DB [ :c_rules ] . where ( instrument_id :)
98
+ DB [ :c_rules ] . where ( id_instrument :)
99
99
end
100
100
101
101
it_has_params ( mean : 19.85 , upper : 33.22 , lower : 6.48 )
@@ -107,11 +107,11 @@ class MontgomerySpec < SpcSpec
107
107
end
108
108
109
109
describe "Mortgage Loan Cost" do
110
- instrument_id = 5
110
+ id_instrument = 5
111
111
112
112
describe "XmR X rules" do
113
113
subject do
114
- DB [ :xmr_x_rules ] . where ( instrument_id :)
114
+ DB [ :xmr_x_rules ] . where ( id_instrument :)
115
115
end
116
116
117
117
it_has_params ( mean : 300.5 , upper : 321.22 , lower : 279.78 )
@@ -123,19 +123,19 @@ class MontgomerySpec < SpcSpec
123
123
124
124
describe "XmR MR rules" do
125
125
subject do
126
- DB [ :xmr_mr_rules ] . where ( instrument_id :)
126
+ DB [ :xmr_mr_rules ] . where ( id_instrument :)
127
127
end
128
128
129
129
it_has_params ( mean : 7.79 , upper : 25.45 , lower : 0 )
130
130
131
- it_has_status_counts_of ( in_control : 39 , out_of_control_upper : 1 , out_of_control_lower : 0 )
131
+ it_has_status_counts_of ( in_control : 38 , out_of_control_upper : 1 , out_of_control_lower : 0 )
132
132
133
133
it_is_out_of_control_at ( upper_samples : [ 165 ] , lower_samples : [ ] )
134
134
end
135
135
end
136
136
137
137
describe "Normal Distribution With Shifting Mean" do
138
- instrument_id = 6
138
+ id_instrument = 6
139
139
140
140
describe "EWMA with fixed targets" do
141
141
subject do
@@ -146,7 +146,7 @@ class MontgomerySpec < SpcSpec
146
146
10 , # target mean
147
147
1 # target std dev
148
148
)
149
- ) . where ( instrument_id :) . order_by ( :sample_id )
149
+ ) . where ( id_instrument :) . order_by ( :id_sample )
150
150
end
151
151
152
152
it_has_params ( mean : 10 , upper : 10.27 , lower : 9.73 )
@@ -156,7 +156,7 @@ class MontgomerySpec < SpcSpec
156
156
it_is_out_of_control_at ( upper_samples : [ 195 , 196 ] , lower_samples : [ ] )
157
157
158
158
# @formatter:off
159
- it_has_correct_values ( column : :exponentially_weighted_moving_average , values : [
159
+ it_has_correct_values ( column : :data_exponentially_weighted_moving_average , values : [
160
160
9.945 , 9.7495 , 9.70355 , 9.8992 , 10.1253 , 10.1307 , 9.92167 , 10.0755 , 9.98796 , 10.0232 ,
161
161
9.92384 , 10.0785 , 10.1216 , 10.0495 , 10.0525 , 9.98426 , 10.0478 , 10.074 , 9.91864 , 10.0108 ,
162
162
10.0997 , 10.0227 , 10.2495 , 10.3745 , 10.3971 , 10.4654 , 10.4568 , 10.5731 , 10.6468 , 10.6341
@@ -171,15 +171,15 @@ class MontgomerySpec < SpcSpec
171
171
0.1 , # weighting
172
172
2.7 # limits
173
173
)
174
- ) . where ( instrument_id :) . order_by ( :sample_id )
174
+ ) . where ( id_instrument :) . order_by ( :id_sample )
175
175
end
176
176
177
177
it_has_params ( mean : 10.315 , upper : 10.626 , lower : 10.004 )
178
178
179
179
it_has_status_counts_of ( in_control : 30 , out_of_control_upper : 0 , out_of_control_lower : 0 )
180
180
181
181
# @formatter:off
182
- it_has_correct_values ( column : :exponentially_weighted_moving_average , values : [
182
+ it_has_correct_values ( column : :data_exponentially_weighted_moving_average , values : [
183
183
10.2285 , 10.0046 , 9.93318 , 10.1058 , 10.3112 , 10.2981 , 10.0723 , 10.2111 , 10.1099 , 10.1329 ,
184
184
10.0226 , 10.1674 , 10.2016 , 10.1215 , 10.1173 , 10.0426 , 10.1003 , 10.1213 , 9.96119 , 10.0490 ,
185
185
10.1341 , 10.0537 , 10.2773 , 10.3996 , 10.4196 , 10.4857 , 10.4751 , 10.5896 , 10.6616 , 10.6474
@@ -195,11 +195,11 @@ class MontgomerySpec < SpcSpec
195
195
5 , # decision interval
196
196
10 # target mean
197
197
)
198
- ) . where ( instrument_id :) . order_by ( :sample_id )
198
+ ) . where ( id_instrument :) . order_by ( :id_sample )
199
199
end
200
200
201
201
describe "Calculating net deviation" do
202
- it_has_correct_values ( column : :deviation , values : [
202
+ it_has_correct_values ( column : :data_deviation , values : [
203
203
# @formatter:off
204
204
-0.55 , -2.01 , -0.71 , 1.66 , 2.16 ,
205
205
0.18 , -1.96 , 1.46 , -0.8 , 0.34 ,
@@ -212,7 +212,7 @@ class MontgomerySpec < SpcSpec
212
212
end
213
213
214
214
describe "Calculating Cₙ" do
215
- it_has_correct_values ( column : :c_n , values : [
215
+ it_has_correct_values ( column : :data_c_n , values : [
216
216
# @formatter:off
217
217
-0.55 , -2.56 , -3.27 , -1.61 , 0.55 ,
218
218
0.73 , -1.23 , 0.23 , -0.57 , -0.23 ,
@@ -225,7 +225,7 @@ class MontgomerySpec < SpcSpec
225
225
end
226
226
227
227
describe "Calculating positive deviation" do
228
- it_has_correct_values ( column : :deviation_plus , values : [
228
+ it_has_correct_values ( column : :data_deviation_plus , values : [
229
229
# @formatter:off
230
230
-1.05 , -2.51 , -1.21 , 1.16 , 1.66 ,
231
231
-0.32 , -2.46 , 0.96 , -1.3 , -0.16 ,
@@ -238,7 +238,7 @@ class MontgomerySpec < SpcSpec
238
238
end
239
239
240
240
describe "Calculating C⁺" do
241
- it_has_correct_values ( column : :c_plus , values : [
241
+ it_has_correct_values ( column : :data_c_plus , values : [
242
242
# @formatter:off
243
243
0 , 0 , 0 , 1.16 , 2.82 ,
244
244
2.50 , 0.04 , 1.00 , 0 , 0 ,
@@ -251,7 +251,7 @@ class MontgomerySpec < SpcSpec
251
251
end
252
252
253
253
describe "Calculating negative deviation" do
254
- it_has_correct_values ( column : :deviation_minus , values : [
254
+ it_has_correct_values ( column : :data_deviation_minus , values : [
255
255
# @formatter:off
256
256
-0.05 , -1.51 , -0.21 , 2.16 , 2.66 ,
257
257
0.68 , -1.46 , 1.96 , -0.3 , 0.84 ,
@@ -264,7 +264,7 @@ class MontgomerySpec < SpcSpec
264
264
end
265
265
266
266
describe "Calculating C⁻" do
267
- it_has_correct_values ( column : :c_minus , values : [
267
+ it_has_correct_values ( column : :data_c_minus , values : [
268
268
# @formatter:off
269
269
-0.05 , -1.56 , -1.77 , 0 , 0 ,
270
270
0 , -1.46 , 0 , -0.3 , 0 ,
0 commit comments