Math Functions: Probability & Statistics Calculator
Math Functions: Probability & Statistics
List of probability and statistics math functions. Many functions include links to more in-depth descriptions and examples.
__Statistics and regression functions are only available in templates. Probability functions are available in both the calculator and templates.__
Probabilities
Factorial [fact]
Calculator
Algebraic: ++fact(value)++
RPN: ++value [fact]++
Returns the factorial of 'value'.
** Details**
- 'value' must be greater than 0 and less than or equal to 170, and must be a whole number
- 'value' outside this range will return a "Parameter out of range" calculation error
- 'value' can either be a whole number or a table of whole numbers, where the same is returned
Template
++fact(value)++
Returns the factorial of 'value'.
**Details**
- 'value' can either be a number or table where the same is returned
- 'value' must be greater than 0 and less than or equal to 170, and must be a whole number
- 'value' outside this range will return a "Parameter out of range" calculation error
- 'value' can either be a whole number or a table of whole numbers, where the same is returned
**Example**
[https://.../t/79d233ecb8b5acfb9549|Probabilities]
Permutations [perm]
Calculator
Algebraic: ++perm(n; r)++
RPN: ++n [ENT] r [perm]++
Returns the number of permutations of 'n' taken 'r' at a time. Permutations are used when several choices are made from the same set and the order they are chosen matters.
** Details**
- 'n' and 'r' must be whole numbers where 'n' is greater than or equal to 'r' and both are greater than 0
- 'n' or 'r' less than 0 or 'n' less than 'r' will return a "Parameter out of range" calculation error
- 'n' and 'r' can either be a table or a number where the same is returned
- If both 'n' and 'r' are tables then they both must be the same length or 'Invalid dimensions' is returned
Template
++perm(n; r)++
Returns the number of permutations of 'n' taken 'r' at a time. Permutations are used when several choices are made from the same set and the order they are chosen matters.
**Details**
- 'n' and 'r' must be whole numbers where 'n' is greater than or equal to 'r' and both are greater than 0
- 'n' or 'r' less than 0 or 'n' less than 'r' will return a "Parameter out of range" calculation error
- 'n' and 'r' can either be a table or a number where the same is returned
- If both 'n' and 'r' are tables then they both must be the same length or 'Invalid dimensions' is returned
**Example**
[https://.../t/79d233ecb8b5acfb9549|Probabilities]
Combinations [comb]
Calculator
Algebraic: ++ comb(n; r)++
RPN: ++n [ENT] r [comb]++
Returns the number of combinations of 'n' taken 'r' at a time. Combinations are used when several choices are made from the same set and the order they are chosen does not matter.
** Details**
- 'n' and 'r' must be whole numbers where 'n' is greater than or equal to 'r' and both are greater than 0
- 'n' or 'r' less than 0 or 'n' less than 'r' will return a "Parameter out of range" calculation error
- 'n' and 'r' can either be a table or a number where the same is returned
- If both 'n' and 'r' are tables then they both must be the same length or 'Invalid dimensions' is returned
Template
++ comb(n; r)++
Returns the number of combinations of 'n' taken 'r' at a time. Combinations are used when several choices are made from the same set and the order they are chosen does not matter.
**Details**
- 'n' and 'r' must be whole numbers where 'n' is greater than or equal to 'r' and both are greater than 0
- 'n' or 'r' less than 0 or 'n' less than 'r' will return a "Parameter out of range" calculation error
- 'n' and 'r' can either be a table or a number where the same is returned
- If both 'n' and 'r' are tables then they both must be the same length or 'Invalid dimensions' is returned
**Example**
[https://.../t/79d233ecb8b5acfb9549|Probabilities]
Random [rand]
Calculator
Algebraic: ++rand()++
RPN: ++[rand]++
Returns a random real number between 0 and 1 inclusive.
Template
++rand()++ : returns a random real number between 0 and 1 inclusive
++rand(length)++ : returns a table of 'length' count filled with random real numbers between 0 and 1 inclusive
++rand(lower; upper)++ : returns a random whole number between 'lower' and 'upper' inclusive
++rand(lower; upper; length)++ : returns a table of 'length' count filled with random whole numbers between 'lower' and 'upper' inclusive
Returns a random number or table.
**Details**
- 'lower', 'upper' and 'length' must be whole numbers or they will be truncated
- 'lower' greater than 'upper' will be reversed internally
- 'lower', 'upper' or 'length' less than or equal to 0 will return a 'Invalid array dimensions' calculator error
Statistics
Count
++count(table)++
Returns the number of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then count(table; 1) is returned.
++count(table; column)++
Returns the number of rows in 'column' of 'table'. No occurrences are considered. Returns the same result as length(table).
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Sum
++sum(table)++
Returns the sum of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then sum(table; 1) is returned.
++ sum(table; column)++
Returns the sum of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Average [avg, mean]
++avg(table)++
Returns the average of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then avg(table; 1) is returned.
++ avg(table; column)++
Returns the average of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
- mean(), average() and avg() return the same results
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Minimum [min]
++ min(table)++ : returns the minimum value in the first column of 'table'. This is the same as min(table; 1)
++ min(table; column)++ : returns the minimum value in 'column' of 'table'
++ min(valueA; valueB; ...)++ : returns the minimum value from a series of numbers. If valueA, valueB, etc. are equal length, single-column tables then this function returns the smallest value of each table row as a new table.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
- minimum() and min() returns the same results
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
Maximum [max]
++ max(table)++ : returns the maximum value in the first column of 'table'. This is the same as max(table; 1)
++ max(table; column)++ : returns the maximum value in 'column' of 'table'
++ max(valueA; valueB; ...)++ : returns the maximum value from a series of numbers. If valueA, valueB, etc. are equal length, single-column tables then this function returns the largest value of each table row as a new table.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
- maximum() and max() returns the same results
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
Range
++ range(table)++
Returns the difference between the maximum and minimum value in the first column of 'table'. This is the same as range(table; 1).
++ range(table; column)++
Returns the difference between the maximum and minimum value in 'column' of 'table'.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
Product
++product(list)++
Returns the product of values in 'list'. 'list' is a single column from a table, which can be extracted from a full table using the [https://.../t/help_functions_tables | column()] function. The product means all elements in the list are multiplied together.
__This function is only available in templates.__
Sum of Products
++sumOfProducts(table)++ : multiplies each column of a row together and returns the sum of all rows. This is the same as sumOfProducts(table; 0).
++sumOfProducts(table; resultsAsTable)++ : multiplies each column of a row together and returns the sum of all rows if 'resultsAsTable' is 0 or returns the results as a table if 'resultsAsTable' is 1.
__This function is only available in templates.__
**Example**
To calculate how many square feet of paint is required, you can do the following:
Define columns for Openings as Length; Height; Occurrences.
[https://.../t/7263d164cdca7b6f9acf |Studs ]
[https://.../t/c7d8818fc1a5ea24d548 | Tile Estimator]
[https://.../t/db176676e37507802ff5 | Floor, Resilient/Carpet]
[https://.../t/e2a7586807a0fc9e8487 | Wallpaper]
[https://.../t/f5dcba9c5e1470819ac7 | Trim, Running]
[https://.../t/ce3d787ecb9aae4d0c3a | Brick Wall, Advanced]
[https://.../t/5561ca53c696c4758813 | Block Wall, Advanced]
Median
++ median(table)++
Returns the median of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then median(table; 1) is returned.
++ median(table; column)++
Returns the median of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
First Quartile [quartile1]
++ quartile1(table)++
Returns the first quartile (median between min() and median()) of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then quartile1(table; 1) is returned.
++ quartile1(table; column)++
Returns the first quartile of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
Third Quartile [quartile3]
++ quartile3(table)++
Returns the third quartile (median between median() and max()) of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then quartile3(table; 1) is returned.
++ quartile3(table; column)++
Returns the third quartile of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/978bb40758d638ba7847|One-Variable Statistics]
Standard Deviation [stddev, stddevp]
++stddev(table)++
Returns the __sample__ standard deviation of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then stddev(table; 1) is returned.
++stddev(table; column)++
Returns the __sample__ standard deviation of rows in 'column' of 'table'. No occurrences are considered.
++stddevp(table)++
Returns the __population__ standard deviation of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then stddevp(table; 1) is returned.
++stddevp(table; column)++
Returns the __population__ standard deviation of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Variance [variance, variancep]
++variance(table)++
Returns the __sample__ variance of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then variance(table; 1) is returned.
++variance(table; column)++
Returns the __sample__ variance of rows in 'column' of 'table'. No occurrences are considered.
++variancep(table)++
Returns the __population__ variance of rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then variancep(table; 1) is returned.
++variancep(table; column)++
Returns the __population__ variance of rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Sum Squared [sum2]
++sum2(table)++
Returns the sum of all squared rows in 'table' where the first column is the values and the second column is the number of occurrences for each row. If there is no second column (the table is a list) then median(table; 1) is returned.
++sum2(table; column)++
Returns the sum of all squared rows in 'column' of 'table'. No occurrences are considered.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Sum XY
++sumXY(table; x-column; y-column)++
Returns the sum of rows in 'x-column' of 'table' multiplied by its corresponding 'y-column' in 'table'.
__This function is only available in templates.__
** Details**
- The first column is index 1
- 'column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Regressions & Forecasting
Regression
++regression(type; table; x-column; y-column)++
Returns a table of regression values where 'table' contains x and y data points, 'x-column' is the column number containing x data, 'y-column' is the column number containing y data, and 'type' is the regression method.
The table returned by the regression() function contains the following results: row 1 contains the coefficient of determination (r²), row 2 contains the correlation coefficient (r), row 3 contains the regression coefficient A, and row 4 contains the regression coefficient B. To extract individual results use the table function [https://.../t/help_functions_tables|item()].
__This function is only available in templates.__
** Details**
- The first column of 'table' is index 1
- 'type' should be 1 for linear regression, 2 for natural log regression, 3 for logarithmic regression, 4 for exponential regression, and 5 for power regression methods
- 'x-column' or 'y-column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
- 'type' less than 1 or greater than 5 will return a 'Parameter out of range' error
**Regression Equations**
The following formulas are used for regression calculations:
- Linear: y = A*x + B
- Natural Log: y = A + B * ln(x), for x > 0
- Logarithmic: y = A + B * log(x), for x > 0
- Exponential: y = A*Bᕽ
- Power: y = A*x^B
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Forecast
++forecast(type; value; table; x-column; y-column)++
Returns the predicted value of the y data set where 'table' contains x and y data points, 'x-column' is the column number containing x data, 'y-column' is the column number containing y data, and 'type' is the regression method. To forecast, an x 'value' is used to predict a y value or vice-a-versa. This form of the function assumes an x-value predicts a y-value.
++forecast(type; value; table; x-column; y-column; forecastXColumn)++
Same as previous except can control whether an x-value is used to predict a y-value (set 'forecastXColumn' equal to 0) or whether a y-value is used to predict an x-value (set 'forecastXColumn' equal to 1).
__This function is only available in templates.__
** Details**
- The first column of 'table' is index 1
- 'type' should be 1 for linear regression, 2 for natural log regression, 3 for logarithmic regression, 4 for exponential regression, and 5 for power regression methods
- 'x-column' or 'y-column' less than 1 or greater than the number of columns will return a 'Invalid array dimensions' error
- 'type' less than 1 or greater than 5 will return a 'Parameter out of range' error
**Regression Equations**
The following formulas are used for forecast calculations:
- Linear: y = A*x + B
- Natural Log: y = A + B * ln(x), for x > 0
- Logarithmic: y = A + B * log(x), for x > 0
- Exponential: y = A*Bᕽ
- Power: y = A*x^B
**Example**
[https://.../t/3f45c711c20b46b0c0be|Two-Variable Statistics]
Keywords
-------------
Stats
Probabilities
Probability
Factorial
fact()
Permutations
perm()
Combinations
comb()
Random
rand()
Statistics
Count
count()
Sum
sum()
Average
avg()
average()
Mean
mean()
Minimum
min()
minimum()
Maximum
max()
maximum()
Range
range()
Median
median()
First Quartile
Third Quartile
quartile1()
quartile3()
Standard Deviation
Sample Standard Deviation
Population Standard Deviation
stddev()
stddevp()
Variance
Sample Variance
Population Variance
variance()
variancep()
Sum Squared
sum2()
Sum XY
Sum X times Y
Sum X * Y
sumxy()
regression()
forecast()
Regression
Forecast
Product
product()