Selection criteria
A selection criterion is a logical expression which evaluates to 1 (= TRUE) or 0 (=FALSE). For every case in the spreadsheet, this expression is evaluated and if the result is TRUE, the case is included in the analysis or graph but if the result is not TRUE, then the case is excluded from the statistical analysis or graph.
1. Simple selection criterion
A basic selection criterion exist of a variable, a logical operator and a constant value. The relational operators, in order of precedence, are:
| = | Equality |
| <> | Inequality |
| < | Less than |
| > | Greater than |
| <= | Less than or equal to |
| >= | Greater than or equal to |
For example, if you have the following data in the spreadsheet:

then the expression AGE>40 can be used as a selection criterion:

When MedCalc calculates the summary statistics for the variable WEIGHT, it will evaluate the expression AGE>40 for every case. MedCalc will only include the cases for which the expression evaluates to the logical value TRUE.
Other examples of selection criteria:
TREATMENT="A" : Treatment must be equal to "A" - notice the use of quotation marks for text constant in formula.
AGE<=60 : Age must be les then or equal to 60
ROW<21 : Only the first 20 cases in the spreadsheet will be selected (see ROW)
2. Combined selection criterion
Different selection criteria can be combined into one single selection criterion using the logical functions AND, OR and NOR, e.g.
AND(AGE>40,AGE<60) : only cases with age more than 40 and less than 60 will be selected.
AND(AGE>40,TREATMENT="A") : only cases with age more than 40 and treatment "A".
OR(AGE>40,TREATMENT="A") : cases with age more than 40 or treatment "A" will be selected.
When you have used a selection criterion, you should check the resulting sample size and verify that the cases you intended to be selected have indeed been selected, and that you did not make a logical error in composing the selection criterion formula.
|