Cypher stDev Function

stDev() returns the standard deviation for the given value over a group. It uses a standard two-pass method, with N-1 as the denominator, and should be used when taking a sample of the population for an unbiased estimate. When the standard variation of the entire population is being calculated, stDevP should be used.

Syntax: stDev(expression)

Returns: A Float

Arguments

NameDescription
expressionA numeric expression.

Example

MATCH (n:Person)
RETURN stDev(n.age)

The standard deviation of the values in the property age for all nodes of the type ‘Person’ is returned.

Considerations

  • All null values are excluded from the calculation.
  • stDev(null) returns 0.

Example

UNWIND [8, 9, 10, 11, 12, 15] AS val
RETURN stDev(val)

Returns the following Result

stDev(val)
2.48327740429189