Skip to main content
1-Visitor
August 28, 2018
Solved

Need some help implementing multirule QC

  • August 28, 2018
  • 1 reply
  • 7948 views

Hi,

     I need a little help in implementing westgard (multirule QC) rules. There are 2 particular rules that I need some programming help with.  

1. The 2 of 3_2s rule: Here I need to show that there is a violation if 2 of the 3 consecutive data points exceed a certain control limit (I don't care about the limit right now. I need to get the program going).

2.The 7T rule: In this case I need to show that there is a violation if 7 consecutive values trend in a particular direction.

 

I am attaching pics for the 2 rules. I am also uploading a demo worksheet. 

Thanks in advance.

Best answer by Werner_E

So I guess I had interpreted the rules correct.

1. rule: Only max. 1 point of the three is allowed to be outside the limits

2. rule: I treat the unlikely event of two consecutive identical data points as being the same trend as the rest, so 1-2-2-3-4-4-4 would mean rule violation as all 7 are considered ascending.

 

Yes, the file is in Prime 5 format and silly as PTC is they do not provide any means to save it in P4 format.

If its enough to output the first set of data which violates the rule all you would have to do is to change the output from "return "rule ... VIOLATION" " to return the point set which violates the rule.

See attached file in Prime 4 format.

If you would need all positions violating the rule it would be more work to do.

Especially because in case of  0-3-4-5-3-2-4-5-0.5-0 and limits +-1 you probably would like to see a single entry [0 3 4 5 3 2 4 5 0.5] which violates the first rule and not [0 3 4], [3 4 5], [4 5 3], [5 3 2], [2 4 5], [4 5 0.5], though every of these set of 3 violates the rule.

1 reply

25-Diamond I
August 28, 2018

Do you need to know the position of the data points violating those rules or are you just looking for a function with the data as argument and the return value is 0 or 1, indicating violation in at least one position or no violation at all?

 

Concerning the 2of3 rule: Is it also violated if one of the three data values is higher than the upper limit and another one is lower than the lower limit?

In other words, does the rule mean that at least 2 data values of 3 consecutive must be within the limits?

 

7T rule:

I guess that if two or more values are equal, the rule might be violated anyway?

Data: 1-2-3-3-3-4-5 means that all have the same trend and the rule is violated, right?

4-4-4-4-4-4-4 means rule violated?

The question is: must it be just monotone or must it be strictly monotone for the rule to be violated?

 

25-Diamond I
August 28, 2018

Here are the functions for my interpretation of your rules.

You may adopt them to your needs:

B.png

arnair811-VisitorAuthor
1-Visitor
August 29, 2018

Thanks Werner. I am not able to open your file in prime 4. Are you using a newer version?

 

I want to determine the values causing the rule violation and then print it along with the corresponding row numbers.

To answer some of your questions

 

Concerning the 2of3 rule: Is it also violated if one of the three data values is higher than the upper limit and another one is lower than the lower limit?  From what I understand (I am pretty new to it as well), at least 2 of the 3 data points must be over mean +/- 2 standard deviation while the 3rd point must be within it.  

 

 

7T rule:

I guess that if two or more values are equal, the rule might be violated anyway?

Data: 1-2-3-3-3-4-5 means that all have the same trend and the rule is violated, right?

4-4-4-4-4-4-4 means rule violated? Chance of 2 data points having the exact same value is next to none for my data set. If there is a trend shift either up or down from 7 consecutive points, then the program needs to show the points causing it as well as the row numbers. Check the attached image for trend shift although I am not sure of finding 7 consecutive data points rising together.

 

Thank you once again and let me know if you need more clarification.