# Visual Analog Scale (VAS) Annotation

Source: https://www.potatoannotator.com/docs/annotation-types/visual-analog-scale

The `vas` scheme shows a plain horizontal line with a word label at each end, and annotators drag a marker to the point on the line that matches the annotator's judgment. Potato stores the marker's position as a decimal number between `min_value` and `max_value`, by default on a 0 to 100 scale in steps of 0.1. The line has no tick marks, and annotators see no number unless `show_value` turns on a readout. Ratings of the pain a clinical note describes, the intensity of an emotion in a text, or the similarity of two items suit the scheme, because each judgment varies continuously and five or seven points would force annotators to round.

A [visual analog scale](https://en.wikipedia.org/wiki/Visual_analogue_scale) (VAS) is a response scale on which a respondent marks a position on a continuous line between two end points. Pain rating is a common clinical use of the format, and slider widgets made the format practical in web surveys. In a web experiment, [Couper et al. (2006)](https://doi.org/10.1177/0894439305281503) found that VAS items produced the same response distributions as radio buttons and numeric text boxes, with more missing data and longer completion times.

## Configuration

The config below asks three annotators to rate the pain each clinical note describes. Three annotators on every note give the agreement report items to score, and `label_requirement` keeps an annotator from moving on before placing the marker:

```yaml
annotation_task_name: "Pain intensity in clinical notes"
task_dir: .
data_files:
  - data/pain-notes.json
item_properties:
  id_key: id
  text_key: text
output_annotation_dir: annotation_output/
export_annotation_format: jsonl
num_annotators_per_item: 3
user_config:
  allow_all_users: true

annotation_schemes:
  - annotation_type: vas
    name: pain_level
    description: "Mark how much pain the note describes."
    left_label: "No pain"
    right_label: "Worst pain imaginable"
    min_value: 0
    max_value: 100
    precision: 1
    show_value: false
    label_requirement:
      required: true
```

A 0 to 100 range lets each stored value read as a percentage of the line. Leaving `show_value` off keeps annotators judging a position between the two anchors rather than picking a number. Each line of `data/pain-notes.json` is one note:

```json
{"id": "note_001", "text": "Patient reports a dull ache in the lower back that flares up when bending over."}
```

## Options

| `vas` option | Default | Meaning |
|---|---|---|
| `name` | required | Scheme name, also the key the answer is stored under |
| `description` | required | The question, shown above the line |
| `left_label` | empty | Text at the left end of the line |
| `right_label` | empty | Text at the right end of the line |
| `min_value` | `0` | Value of the left end |
| `max_value` | `100` | Value of the right end. When a config sets both keys, Potato rejects a `min_value` that is not less than `max_value`. A config with only `min_value: 100` passes and renders a line with an empty range, since `max_value` defaults to 100. Set both keys |
| `precision` | `1` | Decimal places. The marker moves in steps of 0.1 at `1`, 0.01 at `2`, and whole numbers at `0` |
| `show_value` | `false` | Adds a numeric readout under the line that follows the marker. In 2.14.0 the readout also shows the midpoint number on items with no saved answer |
| `label_requirement` | none | `{required: true}` keeps the Next button blocked until the annotator moves the marker. `required: true` on the scheme is shorthand for the same setting |

The scheme takes no option for tick marks, keyboard shortcuts, or the marker's starting position. At the default settings the line has 1,001 positions, from 0.0 to 100.0.

## Midpoint marker and saved answers

Potato draws the marker at the middle of the line when an item opens, at 50.0 on the default scale. The midpoint marker records nothing. Any input on the slider saves a value. Dragging the marker, clicking the line, and pressing the arrow, Home, or End keys on the focused slider all count as input. An item the annotator leaves with no input on the slider keeps no `vas` answer. Moving the marker back to the midpoint after any input still counts as an answer, so an annotator whose answer is the midpoint moves the marker away and back. Because the marker is visible at the midpoint before anyone answers, check the export for a cluster of answers at the midpoint value before treating the midpoint as a neutral rating.

In Potato 2.14.0, a `show_value` readout shows the midpoint number on every unanswered item, although Potato has saved nothing for the item. Once the marker moves, the readout shows the slider's raw value instead of a value at `precision` decimal places. Annotators may read the midpoint number as a saved answer, so consider leaving `show_value` off.

## Stored value

Potato stores each answer as a string, with the scheme name as both the scheme key and the label key. One line of the jsonl export looks like this:

```json
{"instance_id": "note_001", "user_id": "annotator1", "labels": {"pain_level": {"pain_level": "67.3"}}, "spans": {}, "links": {}, "events": {}}
```

The string has at most `precision` decimal places, and analysis code converts the string with `float()`. Annotations persist to `annotation_output/<user>/user_state.json` whatever the export format, and the jsonl export writes one line per annotator per item.

## Agreement

Potato treats `vas` answers as interval data. The agreement report at `/admin/iaa` scores the items whose annotator cap is two or more once each item reaches the cap, and the report gives five measures for a `vas` scheme:

- **Pearson's r**, averaged over pairs of annotators, with each pair scored on the items both annotators answered.
- **Mean absolute error (MAE) and root mean squared error (RMSE)** between the two values of a pair, in the scale's own units and averaged over pairs.
- **[Krippendorff's alpha](https://en.wikipedia.org/wiki/Krippendorff%27s_alpha)** with the interval distance, over every item with two or more answers.
- **ICC(2,k)**, the two-way random-effects, absolute-agreement [intraclass correlation](https://en.wikipedia.org/wiki/Intraclass_correlation) for the average of k annotators ([Shrout and Fleiss, 1979](https://doi.org/10.1037/0033-2909.86.2.420)). Potato computes the ICC only over items that every annotator answered.

The report's `n_aligned_items` field counts the items behind the ICC. When many annotators each see a different subset of items, the count can fall below two and the ICC is left undefined. Krippendorff's alpha still uses every item with two or more answers. [Inter-Annotator Agreement](/docs/guides/inter-annotator-agreement) explains how to choose between the coefficients.

For a methods section, the `reliability` export writes Krippendorff's alpha at the interval level for each `vas` scheme, with a 95% percentile bootstrap interval from 1,000 resamples of items:

```bash
python -m potato.export --config config.yaml --format reliability --output ./export/
```

The export writes `reliability.csv` and `reliability.md`, the same table in Markdown. The table's percent-agreement column counts pairs of annotators who gave identical values. Few pairs match exactly on a line with 1,001 positions. Report Krippendorff's alpha for a `vas` scheme and leave percent agreement out.

## Choosing a continuous or discrete rating scheme

The `vas`, `slider`, `likert`, and `semantic_differential` schemes differ in what annotators see and in the agreement measures Potato computes:

| Scheme | What annotators see | What Potato stores | Agreement scale |
|---|---|---|---|
| `vas` | A plain line with word anchors at both ends and no number by default | One decimal per item | Interval |
| [`slider`](/docs/annotation-types/slider) | A track with tick marks, the current value above the thumb, and the numbers `min_value` and `max_value` at the ends | One number in steps of `step` (default 1) | Interval |
| [`likert`](/docs/annotation-types/likert-scales) | A row of `size` discrete points with `min_label` and `max_label` at the ends | The chosen point | Ordinal |
| [`semantic_differential`](/docs/annotation-types/semantic-differential) | A row of `scale_points` discrete points (default 7) for each pair of opposite adjectives | One point per pair | Per pair and pooled over pairs |

Choose `vas` when the judgment is continuous and words at the two ends define the scale better than numbers do, as in pain, intensity, or similarity. A `slider` fits when the number itself is the answer, such as a percentage, and annotators should see the chosen value. The ends of a slider show only `min_value` and `max_value`, with no word anchors, and a slider scheme with `labels` renders as a column of radio buttons instead of a slider. For word anchors at the ends of a line, use `vas`.

Choose `likert` when the scale has a few named points that every annotator reads the same way, such as agreement from "Strongly disagree" to "Strongly agree". Likert answers get ordinal measures (weighted kappa, Spearman's rho, and ordinal alpha), and two annotators on discrete points can give exactly the same answer. [Rating Scales and Likert Design](/docs/guides/rating-scales) covers how many points to use and the biases to design around.

Choose `semantic_differential` for several pairs of opposite adjectives rated on the same item, with discrete points on each pair. [Funke and Reips (2012)](https://doi.org/10.1177/1525822X12444061) randomly assigned web respondents to semantic differentials built from 5-point scales or from VAS with 250 gradations. Respondents adjusted ratings more often on the VAS version, and the authors observed no differences in means, dropout, nonresponse, or response times. To build a semantic differential from continuous lines in Potato, add one `vas` scheme per adjective pair to `annotation_schemes`, with the two adjectives as the anchors:

```yaml
  - annotation_type: vas
    name: formal_informal
    description: "Where does the text fall between formal and informal?"
    left_label: "Formal"
    right_label: "Informal"
  - annotation_type: vas
    name: warm_cold
    description: "Where does the text fall between warm and cold?"
    left_label: "Warm"
    right_label: "Cold"
```

Each adjective pair then becomes a separate scheme, with a separate row in the agreement report and in the reliability table.

## Example

Potato's release includes a pain-rating example with five short clinical notes. Start the example from the root of a Potato checkout:

```bash
potato start examples/classification/vas/config.yaml -p 8000
```

The example turns on `show_value`, and annotators therefore see a number under the line on every item. Before Potato has saved any answer for an item, that number is the midpoint. Turn `show_value` off and add `label_requirement` before using the config for a real study, then point `data_files` at your own items.

## Further reading

- [Slider](/docs/annotation-types/slider) - A numeric slider with tick marks and a visible value
- [Likert Scales](/docs/annotation-types/likert-scales) - Discrete rating points with labeled ends
- [Semantic Differential](/docs/annotation-types/semantic-differential) - Pairs of opposite adjectives on discrete points
- [Range Slider](/docs/annotation-types/range-slider) - Two thumbs for an interval rather than a point
- [Rating Scales and Likert Design](/docs/guides/rating-scales) - Scale length, endpoint labels, and response biases
- [Inter-Annotator Agreement](/docs/guides/inter-annotator-agreement) - Choosing and reading agreement coefficients

For implementation details, see the [source documentation](https://github.com/davidjurgens/potato/blob/master/docs/annotation-types/measurement/vas.md).

## References

- Couper, M. P., Tourangeau, R., Conrad, F. G., and Singer, E. (2006). Evaluating the effectiveness of visual analog scales: A web experiment. *Social Science Computer Review*, 24(2), 227-245. https://doi.org/10.1177/0894439305281503
- Funke, F., and Reips, U.-D. (2012). Why semantic differentials in web-based research should be made from visual analogue scales and not from 5-point scales. *Field Methods*, 24(3), 310-327. https://doi.org/10.1177/1525822X12444061
- Shrout, P. E., and Fleiss, J. L. (1979). Intraclass correlations: Uses in assessing rater reliability. *Psychological Bulletin*, 86(2), 420-428. https://doi.org/10.1037/0033-2909.86.2.420
