The group by
and group by options
tags can be applied to the enable cheatsweep
widget in order to define different groups and establish different rules for each group. The group by
tag determines the grouping, whereas the group by options
tag is used to set the CheatSweep parameters for each defined group.
enable cheatsweep allow dup: n group by: QCOUNTRY threshold: 80 COUNTRY. type: radio invisible: y cvalue: url_param('c') 1. uk 2. br 3. fr
In the example above, CheatSweep will treat each country defined in QCOUNTRY as a unique scoring group. By default, CheatSweep starts sweeping when N=50, so in this example whenever a country reaches N=50, CheatSweep will begin to sweep at a threshold of 80.
Details
- The
group by
tag accepts a single-select variable for input. - If using the
group by options
tag, thegroup by
tag must be defined. - Options for CheatSweep groups can be define by either rules attached to the tag or a variable.
- If identifying a variable, use
group by options from
. - If identifying through rules on the tag, use
group by options
.
- If identifying a variable, use
Tags
The following tags can be used with group by options
, either as a semicolon-separated list of tags or as element decorators.
Tag | Description | Example |
add rule |
Allows users to include or modify a rule by adding the following lines. The keys (shown to the left of each => arrow) are 'id', 'test', 'bad', and 'good', and should remain unchanged. Change the "values" (on the right side) of each key as appropriate. |
add rule: id => Rule ID here, test => Rule to test returning value, bad => 'Description of failed rule' , good => 'Description of passed rule'
|
disable rules |
Allows users to specify a comma separated list of existing CheatSweep rules that should be disabled, either for all respondents or subsets of respondents. For a list of existing CheatSweep rules, click Custom CheatSweep Rules. |
disable rules: 51, 12 |
remove |
Sets a percentage for which respondents should be removed from the data. An input of 'n%' indicates the highest n% of csp scores should be removed. | remove: 5% |
repeat sweep |
Accepts 'y' and 'n' inputs Setting repeat sweep to 'n' prevents earlier scored respondents from being reclassified (from F to C, or C to F) due to later results. | repeat sweep: n |
seeking value |
Allows users to include condition logic referencing a specific question (or series of questions) to flag respondents who might be attempting to qualify for a survey when they shouldn't. | seeking value: countChecked($Q1) |
start sweep |
Sets a limit to the number of respondents that should be allowed into the survey before CheatSweep starts sweeping the data. By default, CheatSweep will begin analyzing data after 50 respondents. | start sweep: 100 |
threshold |
Sets a minimum CheatSweep probability (csp) score for considering a respondent as possible fraud. Input may be a number 1 and 99 (e.g., '70' indicates anyone with a 70% or higher chance of being fraudulent should be removed). | threshold: 70 |
Additional examples
Defining group by rules with enable cheatsweep
When the rules for groups are defined within the group by options
tag, a heredoc is required. If a particular grouping does not include a CheatSweep tag that is also defined as part of enable cheatsweep - or is a default setting for CheatSweep - then the default/widget level rules will apply to that group. In the example below, since group 2 does not include a start sweep tag but enable cheatsweep does, CheatSweep will begin sweeping group 2's respondent data after the 10th respondent.
enable cheatsweep start sweep: 10 group by: QSAMPLE group by options: <<END 1. remove: 5%; start sweep: 100 2. remove: 8%; repeat sweep: n; disable rules: 51, 12 3. threshold: 85; start sweep: 50 END
Defining group by rules with separate variable
In the following example, QCOUNTRY is used to define the options and rules. Since each country/option in QCOUNTRY uses option data to define their remove
, threshold
, start sweep
, and other values/rates, instead of using group by options
with enable cheatsweep
, use the group by options from
tag.
enable cheatsweep group by: QCOUNTRY group by options from: QCOUNTRY COUNTRY. type: radio invisible: y cvalue: url_param('c') 1. uk {{remove: 5%}} {{start sweep: 30}} 2. br {{remove: 8%}} {{repeatsweep: n}} {{disable rules: 51, 12}} 3. fr {{threshold: 85}} {{start sweep: 100}}
Option level vs. widget level
When the same tag is applied both at the widget level and the option level, the option level rules will prevail. In the example below, the start sweep
rates for the options defined by group by options
would take precedent over the more globally defined level of start sweep: 30
. Any tags applied to enable cheatsweep
that are not included with the options will be applied to those options.
Since the third option does not include a start sweep
tag, it will inherit the start sweep
rate defined outside of the heredoc, beginning at N=30. Options 1 and 2 will also inherit threshold: 80
since neither option includes a threshold
tag, and allow dup: y
will be applied to all options.
enable cheatsweep start sweep: 30 allow dup: y threshold: 80 group by: QCOUNTRY group by options: <<END 1. remove: 5%; start sweep: 25 2. remove: 15%; start sweep: 100 3. threshold: 70; END
With disable rules
In this case, with no start sweep
tag included, CheatSweep will default to starting at N=50 for all options defined in QCOUNTRY. Since allow dup
and disable rules
are defined outside of group by options
, their definitions will apply to all options included in QCOUNTRY.
enable cheatsweep allow dup: y group by: QCOUNTRY group by options: <<END 1. remove: 5% 2. remove: 15% 3. threshold: 70 END disable rules: 51,55,61,105
Comments
0 comments
Please sign in to leave a comment.