Statistical Functions

CalcTree supports a wide set of statistical functions from MathJS to help you analyze numerical datasets, arrays, or matrix values. These are useful in engineering QA, design checks, measurement summaries, and material variability analysis.

You can pass vectors directly (e.g. [10, 15, 20]) or link to values from table columns in your page.

Descriptive Statistics

Function
Description
CalcTree Example

mean(x)

Arithmetic average

mean([1, 2, 3])2

median(x)

Median value

median([1, 5, 10])5

mode(x)

Most frequent value(s)

mode([1, 2, 2, 3])[2]

min(x)

Minimum value

min([4, 2, 8])2

max(x)

Maximum value

max([4, 2, 8])8

sum(x)

Total sum

sum([1, 2, 3])6

prod(x)

Product of all values

prod([2, 3, 4])24

count(x)

Number of elements

count([10, 20, 30])3

quantileSeq(x, p [, sorted])

p-th quantile(s)

quantileSeq([1, 2, 3, 4], 0.25)1.75

Deviation & Spread

Function
Description
CalcTree Example

std(x)

Standard deviation

std([2, 4, 4, 4, 5, 5, 7, 9])

variance(x)

Variance

variance([1, 2, 3])0.666

mad(x)

Median Absolute Deviation

mad([1, 1, 2, 2, 4, 6, 9])2

cumsum(x)

Cumulative sum

cumsum([1, 2, 3])[1, 3, 6]

Correlation

Function
Description
CalcTree Example

corr(a, b)

Correlation coefficient between two arrays

corr([1, 2, 3], [2, 4, 6])1

Notes for CalcTree

  • You can pass arrays using:

    • Inline lists: [value1, value2, value3]

    • Column values from a table

  • Most functions return a unitless scalar, unless your input values carry units (e.g., sum([1 m, 2 m])3 m)

  • If using multi-column data, apply functions separately per column or row using map() or extract with row(), column(), etc.

📘 Looking for more functions? CalcTree’s expression engine is powered by MathJS. For a full list of available functions, visit the MathJS Function Reference. Most functions listed there are supported in CalcTree unless otherwise noted.

Last updated