# Method: Y-Maze Spontaneous Alternation Calculator (method version 1.0.0)

## Calculation

For each animal's sequence of arm entries (arms A, B and C):

1. **Possible alternations** = total entries − 2, the number of overlapping triplets.
2. **Alternations** = triplets of three consecutive entries into three different arms (for example A B C, but not A B A).
3. **% alternation** = alternations / possible alternations × 100. Chance is 50%.
4. **Same-arm returns** = entries into the same arm as the entry before.
5. **Group statistics** per group: mean, standard deviation (n − 1 denominator) and SEM = SD / √n of % alternation and of total entries, over the animals whose value is computable.

The page also reports tetragram entropy and turn bias; they are descriptive and outside this record.

## Reading arm entries

- **Typed sequences** may be spaced ("A B C"), comma-separated ("A,B,C") or run together ("ABC"), in any case.
- **Tracking exports** list one zone per row. Consecutive rows in the same arm are one entry. Rows labelled CENTER, CENTRE, HUB or MIDDLE (any case) mark the center: they are not arms, and an arm row after a center row starts a new entry, so leaving an arm and coming back through the center counts as a same-arm return. A bare "C" is always arm C.

## Conventions

- With fewer than three entries there is no triplet, so % alternation is not computable. The table shows "—", the CSV leaves % alternation and above-chance blank, and the animal is left out of the group's % alternation statistics.
- The typed form accepts sequences of at least three entries; tracking exports can give fewer.
- "Above chance" means % alternation above 50%.

## Worked examples

Four cases in `cases.json`: a 10-entry sequence with every triplet written out, a sequence with one same-arm return, tracking rows with center rows and a return to the same arm, and two entries (edge case).

## References

- Kraeuter AK, Guest PC, Sarnyai Z. The Y-Maze for Assessment of Spatial Working and Reference Memory in Mice. Methods in Molecular Biology. 2019;1916:105-111. https://doi.org/10.1007/978-1-4939-8994-2_10

## Changes from the page before this record

- Tracking exports that list a center zone were read with the center as a fourth arm, which added entries and alternations. For the tracking-rows example the page reported 6 entries and 75% alternation instead of 4 entries and 50%.
- Back-to-back rows of the same arm were merged even when the animal had left through the center, so same-arm returns from tracking exports were always 0.
- An animal with fewer than three entries got 0% alternation, which entered the group mean. It is now not computable and left out.
- Typed sequences of three or more entries give the same results as before.
