statistic_formulas¶
shortfx.fxExcel.statistic_formulas
¶
shortfx fxExcel - Statistical Functions Module
Excel-compatible statistical functions using official English Excel function names. All functions follow Excel's standard naming conventions.
Functions¶
AVEDEV(values: List[float]) -> float
¶
Returns the average of the absolute deviations of data points from their mean.
Excel function: AVEDEV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average absolute deviation |
Raises:
| Type | Description |
|---|---|
ValueError
|
If values is empty |
Cost
O(n) - Linear time complexity
Usage
AVEDEV([4, 5, 6, 7, 5, 4, 3]) 1.020...
Source code in shortfx/fxExcel/statistic_formulas.py
AVERAGE(*values: Union[float, int, List]) -> float
¶
Returns the average (arithmetic mean) of the arguments.
Excel function: AVERAGE (PROMEDIO in Spanish)
Description
Calculates the average of numbers provided as arguments. Ignores text, logical values, and empty cells. If a list is provided, it flattens it.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists of numbers to average |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The arithmetic mean of the values |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values are provided |
Cost
O(n) - Linear time complexity where n is total number of elements
Usage
AVERAGE(10, 20, 30) 20.0 AVERAGE([10, 20, 30]) 20.0 AVERAGE(10, 20, "text", 30) 20.0
Source code in shortfx/fxExcel/statistic_formulas.py
AVERAGEA(*values: Union[float, int, str, bool, List]) -> float
¶
Returns the average of arguments, including numbers, text, and logical values.
Excel function: AVERAGEA
Description
Calculates the average including text and logical values. Text is treated as 0, TRUE as 1, FALSE as 0. Empty cells are ignored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values to average (numbers, text, logical values, lists) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The arithmetic mean of the values |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values are provided |
Cost
O(n) - Linear time complexity where n is total number of elements
Usage
AVERAGEA(10, 20, 30) 20.0 AVERAGEA(10, 20, True, False) 7.75 AVERAGEA(10, "text", 20) 10.0
Source code in shortfx/fxExcel/statistic_formulas.py
AVERAGEIF(range_values: List, criteria, average_range: Optional[List] = None) -> float
¶
Returns the average of cells that meet a criterion.
Excel function: AVERAGEIF (PROMEDIO.SI in Spanish)
Description
Calculates the average of cells in a range that meet a specified criterion. Supports numeric comparisons (>, <, >=, <=, =, <>) and text matching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range_values
|
List
|
Range to evaluate against criteria |
required |
criteria
|
Condition to test (can be number, string with comparison, or text) |
required | |
average_range
|
Optional[List]
|
Optional range to average (if different from range_values) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average of cells meeting the criterion |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values meet the criterion or ranges have different lengths |
Cost
O(n) - Linear time complexity where n is length of range
Usage
AVERAGEIF([10, 20, 30, 40], ">20") 35.0 AVERAGEIF(["apple", "banana", "apple"], "apple", [10, 20, 30]) 20.0
Source code in shortfx/fxExcel/statistic_formulas.py
AVERAGEIFS(average_range: List, *criteria_pairs) -> float
¶
Returns the average of cells that meet multiple criteria.
Excel function: AVERAGEIFS (PROMEDIO.SI.CONJUNTO in Spanish)
Description
Calculates the average of cells that meet multiple criteria. Criteria are specified as pairs of (range, criterion).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
average_range
|
List
|
Range to average |
required |
*criteria_pairs
|
Pairs of (criteria_range, criterion) to test |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average of cells meeting all criteria |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values meet criteria, invalid pairs, or mismatched lengths |
Cost
O(n * m) - where n is range length and m is number of criteria
Usage
AVERAGEIFS([10, 20, 30], [5, 15, 25], ">10", [1, 2, 3], "<3") 15.0
Source code in shortfx/fxExcel/statistic_formulas.py
1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 | |
BETADIST(x: float, alpha: float, beta: float, A: float = 0, B: float = 1) -> float
¶
Returns the beta cumulative distribution (backward compat alias).
Usage Example
round(BETADIST(2, 8, 10, 1, 3), 6) 0.685470
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
BETAINV(probability: float, alpha: float, beta: float, A: float = 0, B: float = 1) -> float
¶
Returns the inverse of the beta cumulative distribution (backward compat alias).
Usage Example
round(BETAINV(0.685470, 8, 10, 1, 3), 1) 2.0
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
BETA_DIST(x: float, alpha: float, beta: float, cumulative: bool = True, A: float = 0, B: float = 1) -> float
¶
Returns the beta probability distribution function.
Excel function: BETA.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value between A and B at which to evaluate |
required |
alpha
|
float
|
First parameter of the distribution (α > 0) |
required |
beta
|
float
|
Second parameter of the distribution (β > 0) |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
True
|
A
|
float
|
Lower bound of interval (default 0) |
0
|
B
|
float
|
Upper bound of interval (default 1) |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Beta distribution value |
Cost
O(1) - Constant time
Usage
BETA_DIST(2, 8, 10, True, 1, 3) 0.685...
Source code in shortfx/fxExcel/statistic_formulas.py
BETA_INV(probability: float, alpha: float, beta: float, A: float = 0, B: float = 1) -> float
¶
Returns the inverse of the beta cumulative distribution function.
Excel function: BETA.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the beta distribution |
required |
alpha
|
float
|
First parameter of the distribution |
required |
beta
|
float
|
Second parameter of the distribution |
required |
A
|
float
|
Lower bound of interval (default 0) |
0
|
B
|
float
|
Upper bound of interval (default 1) |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Value for which the beta CDF equals probability |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
BINOMDIST(number_s: int, trials: int, probability_s: float, cumulative: bool = True) -> float
¶
Returns the binomial distribution probability (backward compat alias).
Usage Example
round(BINOMDIST(6, 10, 0.5, False), 6) 0.205078
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
BINOM_DIST(number_s: int, trials: int, probability_s: float, cumulative: bool) -> float
¶
Returns the individual term binomial distribution probability.
Excel function: BINOM.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_s
|
int
|
Number of successes in trials |
required |
trials
|
int
|
Number of independent trials |
required |
probability_s
|
float
|
Probability of success on each trial |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PMF |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Binomial distribution probability |
Cost
O(1) - Constant time
Usage
BINOM_DIST(6, 10, 0.5, False) 0.205...
Source code in shortfx/fxExcel/statistic_formulas.py
BINOM_DIST_RANGE(trials: int, probability_s: float, number_s: int, number_s2: Optional[int] = None) -> float
¶
Returns the probability of a trial result using a binomial distribution.
Excel function: BINOM.DIST.RANGE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trials
|
int
|
Number of independent trials |
required |
probability_s
|
float
|
Probability of success on each trial |
required |
number_s
|
int
|
Lower bound of successes |
required |
number_s2
|
Optional[int]
|
Upper bound of successes (if None, equals number_s) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Probability of number_s to number_s2 successes |
Cost
O(k) - where k is the range size
Source code in shortfx/fxExcel/statistic_formulas.py
BINOM_INV(trials: int, probability_s: float, alpha: float) -> int
¶
Returns the smallest value for which the cumulative binomial distribution is >= criterion.
Excel function: BINOM.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
trials
|
int
|
Number of Bernoulli trials |
required |
probability_s
|
float
|
Probability of success on each trial |
required |
alpha
|
float
|
Criterion value |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Smallest number of successes |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
CHIDIST(x: float, deg_freedom: int) -> float
¶
Returns the right-tailed chi-squared distribution (backward compat alias).
Usage Example
round(CHIDIST(18.307, 10), 4) 0.0500
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
CHIINV(probability: float, deg_freedom: int) -> float
¶
Returns the inverse of the right-tailed chi-squared distribution (backward compat alias).
Usage Example
round(CHIINV(0.05, 10), 3) 18.307
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
CHISQ_DIST(x: float, deg_freedom: int, cumulative: bool = True) -> float
¶
Returns the chi-squared distribution.
Excel function: CHISQ.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate the distribution |
required |
deg_freedom
|
int
|
Number of degrees of freedom |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Chi-squared distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
CHISQ_DIST_RT(x: float, deg_freedom: int) -> float
¶
Returns the right-tailed probability of the chi-squared distribution.
Excel function: CHISQ.DIST.RT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
deg_freedom
|
int
|
Number of degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Right-tailed probability |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
CHISQ_INV(probability: float, deg_freedom: int) -> float
¶
Returns the inverse of the left-tailed probability of the chi-squared distribution.
Excel function: CHISQ.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the chi-squared distribution |
required |
deg_freedom
|
int
|
Number of degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
CHISQ_INV_RT(probability: float, deg_freedom: int) -> float
¶
Returns the inverse of the right-tailed probability of the chi-squared distribution.
Excel function: CHISQ.INV.RT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the chi-squared distribution |
required |
deg_freedom
|
int
|
Number of degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
CHISQ_TEST(actual_range: List[Union[float, int]], expected_range: List[Union[float, int]]) -> float
¶
Returns the test for independence (chi-squared test).
Excel function: CHISQ.TEST (PRUEBA.CHICUAD in Spanish)
Description
Returns the value from the chi-squared distribution for the statistic and the appropriate degrees of freedom. Used to determine whether a hypothesis is confirmed by an experiment.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actual_range
|
List[Union[float, int]]
|
Range of observed data |
required |
expected_range
|
List[Union[float, int]]
|
Range of expected values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
P-value from chi-squared test |
Raises:
| Type | Description |
|---|---|
ValueError
|
If ranges have different lengths or invalid values |
Cost
O(n) - Linear time complexity
Usage
CHISQ_TEST([58, 35], [45.35, 47.65]) 0.000308...
Source code in shortfx/fxExcel/statistic_formulas.py
CHITEST(actual_range: List[List[float]], expected_range: List[List[float]]) -> float
¶
Returns the chi-squared test for independence (backward compat alias).
Usage Example
CHITEST([[58, 35], [11, 25]], [[43.35, 49.65], [25.65, 10.35]]) # doctest: +SKIP 0.000...
Cost: O(r * c)
Source code in shortfx/fxExcel/statistic_formulas.py
CONFIDENCE(alpha: float, standard_dev: float, size: int) -> float
¶
Returns the confidence interval (backward compat alias).
Excel function: CONFIDENCE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance level. |
required |
standard_dev
|
float
|
Population standard deviation. |
required |
size
|
int
|
Sample size. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Confidence interval half-width. |
Usage Example
CONFIDENCE(0.05, 2.5, 50) 0.6929...
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
CONFIDENCE_NORM(alpha: float, standard_dev: float, size: int) -> float
¶
Returns the confidence interval for a population mean (normal distribution).
Excel function: CONFIDENCE.NORM
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance level (e.g., 0.05 for 95% confidence) |
required |
standard_dev
|
float
|
Population standard deviation |
required |
size
|
int
|
Sample size |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Confidence interval margin |
Cost
O(1) - Constant time
Usage
CONFIDENCE_NORM(0.05, 2.5, 50) 0.692...
Source code in shortfx/fxExcel/statistic_formulas.py
CONFIDENCE_T(alpha: float, standard_dev: float, size: int) -> float
¶
Returns the confidence interval for a population mean (t-distribution).
Excel function: CONFIDENCE.T
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alpha
|
float
|
Significance level (e.g., 0.05 for 95% confidence) |
required |
standard_dev
|
float
|
Sample standard deviation |
required |
size
|
int
|
Sample size |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Confidence interval margin |
Cost
O(1) - Constant time
Usage
CONFIDENCE_T(0.05, 1, 50) 0.284...
Source code in shortfx/fxExcel/statistic_formulas.py
CORREL(array1: List[float], array2: List[float]) -> float
¶
Returns the correlation coefficient between two data sets.
Excel function: CORREL
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[float]
|
First array of values |
required |
array2
|
List[float]
|
Second array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Correlation coefficient between -1 and 1 |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or less than 2 elements |
Cost
O(n) - Linear time complexity
Usage
CORREL([1, 2, 3], [2, 4, 6]) 1.0
Source code in shortfx/fxExcel/statistic_formulas.py
COUNT(*values: Union[float, int]) -> int
¶
Counts the number of cells that contain numbers.
Excel function: COUNT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int]
|
Values to count (only numeric values are counted) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Count of numeric values |
Cost
O(n) - Linear time complexity
Usage
COUNT(1, 2, "text", None, 3.5) 3
Source code in shortfx/fxExcel/statistic_formulas.py
COUNTA(*values: Any) -> int
¶
Counts the number of cells that are not empty.
Excel function: COUNTA
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Any
|
Values to count (all non-None values are counted) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Count of non-None values |
Cost
O(n) - Linear time complexity
Usage
COUNTA(1, 2, "text", None, 3.5) 4
Source code in shortfx/fxExcel/statistic_formulas.py
COUNTBLANK(range_values: List[Any]) -> int
¶
Counts empty cells in a range.
Excel function: COUNTBLANK
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range_values
|
List[Any]
|
Range of cells to check |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Count of blank (None or empty string) cells |
Cost
O(n) - Linear time complexity
Usage
COUNTBLANK([1, None, "", 3, None]) 3
Source code in shortfx/fxExcel/statistic_formulas.py
COUNTIF(range_values: List[Any], criteria: Any) -> int
¶
Counts the number of cells that meet a criterion.
Excel function: COUNTIF
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
range_values
|
List[Any]
|
Range of values to evaluate |
required |
criteria
|
Any
|
Criterion in the form of a number, expression, or text Supports operators: >, <, >=, <=, =, <> |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Count of cells meeting the criteria |
Cost
O(n) - Linear time complexity
Usage
COUNTIF([1, 2, 3, 4, 5], ">3") 2
Source code in shortfx/fxExcel/statistic_formulas.py
COUNTIFS(*args) -> int
¶
Counts cells that meet multiple criteria.
Excel function: COUNTIFS
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*args
|
Alternating range and criteria pairs (range1, criteria1, range2, criteria2, ...) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Count of cells meeting all criteria |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arguments are not in pairs |
Cost
O(n * m) - where m is number of criteria
Usage
COUNTIFS([1,2,3,4], ">2", [10,20,30,40], "<35") 2
Source code in shortfx/fxExcel/statistic_formulas.py
COVAR(array1: List[float], array2: List[float]) -> float
¶
Returns covariance (legacy Excel 2007 function, equivalent to COVARIANCE.P).
Excel function: COVAR
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[float]
|
First array of values |
required |
array2
|
List[float]
|
Second array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population covariance |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
COVARIANCE_P(array1: List[float], array2: List[float]) -> float
¶
Returns population covariance, the average of the products of deviations.
Excel function: COVARIANCE.P
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[float]
|
First array of values |
required |
array2
|
List[float]
|
Second array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population covariance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or are empty |
Cost
O(n) - Linear time complexity
Usage
COVARIANCE_P([3, 2, 4, 5, 6], [9, 7, 12, 15, 17]) 5.2
Source code in shortfx/fxExcel/statistic_formulas.py
COVARIANCE_S(array1: List[float], array2: List[float]) -> float
¶
Returns sample covariance.
Excel function: COVARIANCE.S
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[float]
|
First array of values |
required |
array2
|
List[float]
|
Second array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample covariance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or less than 2 elements |
Cost
O(n) - Linear time complexity
Usage
COVARIANCE_S([2, 4, 8], [5, 11, 12]) 9.666...
Source code in shortfx/fxExcel/statistic_formulas.py
CRITBINOM(trials: int, probability_s: float, alpha: float) -> int
¶
Returns the smallest value for cumulative binomial distribution (backward compat alias).
Usage Example
CRITBINOM(6, 0.5, 0.75) 4
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
DEVSQ(values: List[float]) -> float
¶
Returns the sum of squares of deviations.
Excel function: DEVSQ
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Array of values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sum of squared deviations from mean |
Raises:
| Type | Description |
|---|---|
ValueError
|
If values is empty |
Cost
O(n) - Linear time complexity
Usage
DEVSQ([4, 5, 6, 7, 5, 4, 3]) 16.857...
Source code in shortfx/fxExcel/statistic_formulas.py
EXPONDIST(x: float, lambda_: float, cumulative: bool = True) -> float
¶
Returns the exponential distribution (backward compat alias).
Usage Example
round(EXPONDIST(0.2, 10, True), 6) 0.864665
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
EXPON_DIST(x: float, lambda_: float, cumulative: bool) -> float
¶
Returns the exponential distribution.
Excel function: EXPON.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
lambda_
|
float
|
Parameter value (rate parameter) |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Exponential distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
FDIST(x: float, deg_freedom1: int, deg_freedom2: int) -> float
¶
Returns the right-tailed F probability distribution (backward compat alias).
Usage Example
round(FDIST(15.2069, 6, 4), 4) 0.0100
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
FINV(probability: float, deg_freedom1: int, deg_freedom2: int) -> float
¶
Returns the inverse of the right-tailed F distribution (backward compat alias).
Usage Example
round(FINV(0.01, 6, 4), 4) 15.2069
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
FISHER(x: float) -> float
¶
Returns the Fisher transformation.
Excel function: FISHER
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value for which to calculate the transformation (-1 < x < 1) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Fisher transformation value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If x is not in valid range |
Cost
O(1) - Constant time
Usage
FISHER(0.75) 0.972...
Source code in shortfx/fxExcel/statistic_formulas.py
FISHERINV(y: float) -> float
¶
Returns the inverse of the Fisher transformation.
Excel function: FISHERINV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
y
|
float
|
Value for which to perform the inverse transformation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse Fisher transformation value |
Cost
O(1) - Constant time
Usage
FISHERINV(0.972) 0.75...
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST(x: float, known_y: List[float], known_x: Optional[List[float]] = None) -> float
¶
Returns a single predicted value along a linear trend (backward compat).
Excel function: FORECAST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The x-value for which to predict y. |
required |
known_y
|
List[float]
|
Set of known y-values. |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The predicted y-value. |
Usage Example
FORECAST(6, [1, 2, 3, 4, 5], [10, 20, 30, 40, 50]) 0.6
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST_ETS(target_date: float, values: List[float], timeline: List[float], seasonality: Optional[int] = None, data_completion: int = 1, aggregation: int = 1) -> float
¶
Returns a forecasted value based on exponential smoothing (simplified).
Excel function: FORECAST.ETS
Note: This is a simplified implementation. Full ETS requires complex state space models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_date
|
float
|
Data point for which to predict |
required |
values
|
List[float]
|
Historical values |
required |
timeline
|
List[float]
|
Historical timeline |
required |
seasonality
|
Optional[int]
|
Seasonal period length (auto-detected if None) |
None
|
data_completion
|
int
|
How to handle missing data (1=interpolate, 0=zero) |
1
|
aggregation
|
int
|
How to aggregate duplicate times (1=average) |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Forecasted value |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST_ETS_CONFINT(target_date: float, values: List[float], timeline: List[float], confidence_level: float = 0.95, seasonality: Optional[int] = None, data_completion: int = 1, aggregation: int = 1) -> tuple
¶
Returns confidence interval for forecast (simplified).
Excel function: FORECAST.ETS.CONFINT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target_date
|
float
|
Data point for which to predict |
required |
values
|
List[float]
|
Historical values |
required |
timeline
|
List[float]
|
Historical timeline |
required |
confidence_level
|
float
|
Confidence level (default 0.95 for 95%) |
0.95
|
seasonality
|
Optional[int]
|
Seasonal period length |
None
|
data_completion
|
int
|
How to handle missing data |
1
|
aggregation
|
int
|
How to aggregate duplicate times |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
tuple
|
(lower_bound, upper_bound) |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST_ETS_SEASONALITY(values: List[float], timeline: List[float], data_completion: int = 1, aggregation: int = 1) -> int
¶
Returns the detected seasonality length (simplified).
Excel function: FORECAST.ETS.SEASONALITY
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Historical values |
required |
timeline
|
List[float]
|
Historical timeline |
required |
data_completion
|
int
|
How to handle missing data |
1
|
aggregation
|
int
|
How to aggregate duplicate times |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Detected seasonality period (simplified: returns 12 for monthly) |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST_ETS_STAT(values: List[float], timeline: List[float], statistic_type: int, seasonality: Optional[int] = None, data_completion: int = 1, aggregation: int = 1) -> float
¶
Returns statistical value for ETS forecast (simplified).
Excel function: FORECAST.ETS.STAT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Historical values |
required |
timeline
|
List[float]
|
Historical timeline |
required |
statistic_type
|
int
|
Type of statistic to return (1=Alpha, 2=Beta, 3=Gamma, etc.) |
required |
seasonality
|
Optional[int]
|
Seasonal period length |
None
|
data_completion
|
int
|
How to handle missing data |
1
|
aggregation
|
int
|
How to aggregate duplicate times |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Requested statistic |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
FORECAST_LINEAR(x: float, known_y: List[float], known_x: Optional[List[float]] = None) -> float
¶
Returns a value along a linear trend using linear regression.
Excel function: FORECAST.LINEAR (also FORECAST in older Excel)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Data point for which to predict a value |
required |
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Forecasted value |
Cost
O(n) - Linear time complexity
Usage
FORECAST_LINEAR(30, [6, 7, 9, 15, 21], [20, 28, 31, 38, 40]) 10.607...
Source code in shortfx/fxExcel/statistic_formulas.py
FREQUENCY(data_array: List[float], bins_array: List[float]) -> List[int]
¶
Returns a frequency distribution as a vertical array.
Excel function: FREQUENCY
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data_array
|
List[float]
|
Array of values for which to count frequencies |
required |
bins_array
|
List[float]
|
Array of intervals into which to group values |
required |
Returns:
| Type | Description |
|---|---|
List[int]
|
List[int]: Frequency counts for each bin |
Cost
O(n log n) - Due to binning operation
Usage
FREQUENCY([79, 85, 78, 85, 50, 81, 95, 88, 97], [70, 79, 89]) [1, 2, 4, 2]
Source code in shortfx/fxExcel/statistic_formulas.py
FTEST(array1: List[float], array2: List[float]) -> float
¶
Returns the F-test result (backward compat alias).
Usage Example
FTEST([6, 7, 9, 15, 21], [20, 28, 31, 38, 40]) # doctest: +SKIP 0.648...
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
F_DIST(x: float, deg_freedom1: int, deg_freedom2: int, cumulative: bool = True) -> float
¶
Returns the F probability distribution.
Excel function: F.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
deg_freedom1
|
int
|
Numerator degrees of freedom |
required |
deg_freedom2
|
int
|
Denominator degrees of freedom |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
F distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
F_DIST_RT(x: float, deg_freedom1: int, deg_freedom2: int) -> float
¶
Returns the right-tailed F probability distribution.
Excel function: F.DIST.RT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
deg_freedom1
|
int
|
Numerator degrees of freedom |
required |
deg_freedom2
|
int
|
Denominator degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Right-tailed probability |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
F_INV(probability: float, deg_freedom1: int, deg_freedom2: int) -> float
¶
Returns the inverse of the F probability distribution.
Excel function: F.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the F distribution |
required |
deg_freedom1
|
int
|
Numerator degrees of freedom |
required |
deg_freedom2
|
int
|
Denominator degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
F_INV_RT(probability: float, deg_freedom1: int, deg_freedom2: int) -> float
¶
Returns the inverse of the right-tailed F probability distribution.
Excel function: F.INV.RT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the F distribution |
required |
deg_freedom1
|
int
|
Numerator degrees of freedom |
required |
deg_freedom2
|
int
|
Denominator degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
F_TEST(array1: List[Union[float, int]], array2: List[Union[float, int]]) -> float
¶
Returns the result of an F-test.
Excel function: F.TEST (PRUEBA.F.N in Spanish)
Description
Returns the two-tailed probability that the variances in array1 and array2 are not significantly different. Used to determine whether two samples have different variances.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[Union[float, int]]
|
First array of data |
required |
array2
|
List[Union[float, int]]
|
Second array of data |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Two-tailed P-value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays don't have enough values |
Cost
O(n) - Linear time complexity
Usage
F_TEST([6, 7, 9, 15, 21], [20, 28, 31, 38, 40]) 0.648...
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMA(number: float) -> float
¶
Returns the gamma function value.
Excel function: GAMMA
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
float
|
Value for which to calculate gamma |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Gamma function value |
Cost
O(1) - Constant time
Usage
GAMMA(2.5) 1.329...
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMADIST(x: float, alpha: float, beta: float, cumulative: bool = True) -> float
¶
Returns the gamma distribution (backward compat alias).
Usage Example
round(GAMMADIST(10.00001131, 9, 2, False), 6) 0.032639
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMAINV(probability: float, alpha: float, beta: float) -> float
¶
Returns the inverse of the gamma cumulative distribution (backward compat alias).
Usage Example
round(GAMMAINV(0.068094, 9, 2), 4) 10.0000
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMALN(x: float) -> float
¶
Returns the natural logarithm of the gamma function.
Excel function: GAMMALN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value for which to calculate ln(gamma) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Natural logarithm of gamma(x) |
Cost
O(1) - Constant time
Usage
GAMMALN(4) 1.791...
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMALN_PRECISE(x: float) -> float
¶
Returns the natural logarithm of the gamma function (precise version).
Excel function: GAMMALN.PRECISE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value for which to calculate ln(gamma) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Natural logarithm of gamma(x) |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMA_DIST(x: float, alpha: float, beta: float, cumulative: bool) -> float
¶
Returns the gamma distribution.
Excel function: GAMMA.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
alpha
|
float
|
Shape parameter |
required |
beta
|
float
|
Scale parameter |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Gamma distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
GAMMA_INV(probability: float, alpha: float, beta: float) -> float
¶
Returns the inverse of the gamma cumulative distribution.
Excel function: GAMMA.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the gamma distribution |
required |
alpha
|
float
|
Shape parameter |
required |
beta
|
float
|
Scale parameter |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
GAUSS(z: float) -> float
¶
Returns 0.5 less than the standard normal cumulative distribution.
Excel function: GAUSS
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float
|
Value for which to calculate |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
P(0 < Z < z) for standard normal distribution |
Cost
O(1) - Constant time
Usage
GAUSS(2) 0.477...
Source code in shortfx/fxExcel/statistic_formulas.py
GEOMEAN(values: List[float]) -> float
¶
Returns the geometric mean of an array of positive numbers.
Excel function: GEOMEAN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Array of positive values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Geometric mean |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any value is zero or negative |
Cost
O(n) - Linear time complexity
Usage
GEOMEAN([4, 5, 8, 7, 11, 4, 3]) 5.476...
Source code in shortfx/fxExcel/statistic_formulas.py
GROWTH(known_y: List[float], known_x: Optional[List[float]] = None, new_x: Optional[List[float]] = None, const: bool = True) -> List[float]
¶
Returns values along an exponential trend.
Excel function: GROWTH
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Optional set of known x-values (defaults to 1, 2, 3, ...) |
None
|
new_x
|
Optional[List[float]]
|
Optional new x-values for prediction (defaults to known_x) |
None
|
const
|
bool
|
If True, calculate b normally; if False, force b to equal 1 |
True
|
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: Predicted exponential values |
Raises:
| Type | Description |
|---|---|
ValueError
|
If known arrays have different lengths |
Cost
O(n) - Linear time complexity
Usage
GROWTH([10, 20, 40, 80], [1, 2, 3, 4], [5, 6]) [160.0, 320.0]
Source code in shortfx/fxExcel/statistic_formulas.py
HARMEAN(values: List[float]) -> float
¶
Returns the harmonic mean of a data set.
Excel function: HARMEAN
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Array of positive values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Harmonic mean |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any value is zero or negative |
Cost
O(n) - Linear time complexity
Usage
HARMEAN([4, 5, 8, 7, 11, 4, 3]) 5.028...
Source code in shortfx/fxExcel/statistic_formulas.py
HYPGEOMDIST(sample_s: int, number_sample: int, population_s: int, number_pop: int) -> float
¶
Returns the hypergeometric distribution (backward compat alias).
Usage Example
round(HYPGEOMDIST(1, 4, 8, 20), 6) 0.363261
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
HYPGEOM_DIST(sample_s: int, number_sample: int, population_s: int, number_pop: int, cumulative: bool) -> float
¶
Returns the hypergeometric distribution.
Excel function: HYPGEOM.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample_s
|
int
|
Number of successes in the sample |
required |
number_sample
|
int
|
Size of the sample |
required |
population_s
|
int
|
Number of successes in the population |
required |
number_pop
|
int
|
Population size |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PMF |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Hypergeometric distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
INTERCEPT(known_y: List[float], known_x: Optional[List[float]] = None) -> float
¶
Returns the intercept of the linear regression line.
Excel function: INTERCEPT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Y-intercept value |
Cost
O(n) - Linear time complexity
Usage
INTERCEPT([2, 3, 9, 1, 8], [6, 5, 11, 7, 5]) 0.048...
Source code in shortfx/fxExcel/statistic_formulas.py
KURT(values: List[float]) -> float
¶
Returns the kurtosis of a data set (excess kurtosis).
Excel function: KURT
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[float]
|
Array of values (requires at least 4 data points) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Kurtosis value (excess kurtosis using Fisher's definition) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 4 data points |
Cost
O(n) - Linear time complexity
Usage
KURT([3, 4, 5, 2, 3, 4, 5, 6, 4, 7]) -0.1518...
Source code in shortfx/fxExcel/statistic_formulas.py
LARGE(array: List[float], k: int) -> float
¶
Returns the k-th largest value in a data set.
Excel function: LARGE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[float]
|
Array of values |
required |
k
|
int
|
Position (from the largest) in the array to return |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
k-th largest value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If k is out of valid range |
Cost
O(n log n) - Due to sorting
Usage
LARGE([3, 5, 3, 5, 4], 3) 4
Source code in shortfx/fxExcel/statistic_formulas.py
LINEST(known_y: List[float], known_x: Optional[List[float]] = None, const: bool = True, stats_flag: bool = False) -> Union[tuple, List[float]]
¶
Returns statistics for a linear trend.
Excel function: LINEST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...) |
None
|
const
|
bool
|
If True, force constant term; if False, force through origin |
True
|
stats_flag
|
bool
|
If True, return additional regression statistics |
False
|
Returns:
| Type | Description |
|---|---|
Union[tuple, List[float]]
|
tuple or List[float]: Slope and intercept, or extended statistics |
Cost
O(n) - Linear time complexity
Usage
LINEST([1, 9, 5, 7], [0, 4, 2, 3]) (2.0, 1.0)
Source code in shortfx/fxExcel/statistic_formulas.py
LOGEST(known_y: List[float], known_x: Optional[List[float]] = None, const: bool = True, stats_flag: bool = False) -> Union[tuple, List[float]]
¶
Returns parameters of an exponential trend.
Excel function: LOGEST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...) |
None
|
const
|
bool
|
If True, calculate b normally; if False, force b = 1 |
True
|
stats_flag
|
bool
|
If True, return additional regression statistics |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
Union[tuple, List[float]]
|
Base and multiplier for exponential curve |
Cost
O(n) - Linear time complexity
Source code in shortfx/fxExcel/statistic_formulas.py
LOGINV(probability: float, mean: float, standard_dev: float) -> float
¶
Returns the inverse of the lognormal cumulative distribution (backward compat alias).
Usage Example
round(LOGINV(0.039084, 3.5, 1.2), 4) 4.7002
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
LOGNORMDIST(x: float, mean: float, standard_dev: float) -> float
¶
Returns the cumulative lognormal distribution (backward compat alias).
Usage Example
round(LOGNORMDIST(4, 3.5, 1.2), 6) 0.039084
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
LOGNORM_DIST(x: float, mean: float, standard_dev: float, cumulative: bool) -> float
¶
Returns the lognormal distribution.
Excel function: LOGNORM.DIST
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate |
required |
mean
|
float
|
Mean of the natural logarithm |
required |
standard_dev
|
float
|
Standard deviation of the natural logarithm |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Lognormal distribution value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
LOGNORM_INV(probability: float, mean: float, standard_dev: float) -> float
¶
Returns the inverse of the lognormal cumulative distribution.
Excel function: LOGNORM.INV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the lognormal distribution |
required |
mean
|
float
|
Mean of the natural logarithm |
required |
standard_dev
|
float
|
Standard deviation of the natural logarithm |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Inverse value |
Cost
O(1) - Constant time
Source code in shortfx/fxExcel/statistic_formulas.py
MAX(*values: Union[float, int]) -> float
¶
Returns the largest value in a set of values.
Excel function: MAX
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int]
|
Values to evaluate (ignores text and logical values) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Maximum value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values provided |
Cost
O(n) - Linear time complexity
Usage
MAX(10, 7, 9, 27, 2) 27
Source code in shortfx/fxExcel/statistic_formulas.py
MAXA(*values: Any) -> float
¶
Returns the largest value in a set of values (includes text and logical values).
Excel function: MAXA
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Any
|
Values to evaluate (TRUE=1, FALSE=0, text=0) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Maximum value |
Cost
O(n) - Linear time complexity
Usage
MAXA(10, 7, 9, True, 2) 10
Source code in shortfx/fxExcel/statistic_formulas.py
MAXIFS(max_range: List[float], *args) -> float
¶
Returns the maximum value among cells specified by a given set of conditions.
Excel function: MAXIFS
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_range
|
List[float]
|
Range of cells from which to return maximum |
required |
*args
|
Alternating criteria_range and criteria pairs |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Maximum value meeting all criteria |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values meet criteria or args not in pairs |
Cost
O(n * m) - where m is number of criteria
Usage
MAXIFS([10, 20, 30, 40], [1, 2, 3, 4], ">2") 40
Source code in shortfx/fxExcel/statistic_formulas.py
MEDIAN(*values: Union[float, int, List]) -> float
¶
Returns the median (middle value) of the given numbers.
Excel function: MEDIAN (MEDIANA in Spanish)
Description
Returns the median, the number in the middle of a set of numbers. If there is an even number of values, returns the average of the two middle values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists of numbers |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The median value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values are provided |
Cost
O(n log n) - Due to sorting
Usage
MEDIAN(1, 2, 3, 4, 5) 3.0 MEDIAN(1, 2, 3, 4) 2.5
Source code in shortfx/fxExcel/statistic_formulas.py
MIN(*values: Union[float, int, List]) -> float
¶
Returns the minimum value from a set of values.
Excel function: MIN
Description
Returns the smallest number in a set of values. Ignores text and logical values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists of numbers |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The minimum value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values are provided |
Cost
O(n) - Linear time complexity
Usage
MIN(10, 20, 5, 30) 5 MIN([10, 20, 5, 30]) 5
Source code in shortfx/fxExcel/statistic_formulas.py
MINA(*values: Union[float, int, str, bool, List]) -> float
¶
Returns the minimum value, including numbers, text, and logical values.
Excel function: MINA
Description
Returns the smallest value treating text as 0, TRUE as 1, FALSE as 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values to evaluate |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The minimum value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values are provided |
Cost
O(n) - Linear time complexity
Usage
MINA(10, 20, True, False) 0 MINA(10, "text", 20) 0
Source code in shortfx/fxExcel/statistic_formulas.py
MINIFS(min_range: List, *criteria_pairs) -> float
¶
Returns the minimum value among cells specified by a set of conditions.
Excel function: MINIFS (MIN.SI.CONJUNTO in Spanish)
Description
Returns the minimum value from cells that meet multiple criteria.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_range
|
List
|
Range to find minimum from |
required |
*criteria_pairs
|
Pairs of (criteria_range, criterion) |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Minimum value meeting all criteria |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values meet criteria or invalid arguments |
Cost
O(n * m) - where n is range length and m is number of criteria
Usage
MINIFS([10, 20, 30], [5, 15, 25], ">10") 20
Source code in shortfx/fxExcel/statistic_formulas.py
MODE(values: List[Union[float, int]]) -> float
¶
Returns the most common value in a data set (backward compat alias).
Excel function: MODE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[Union[float, int]]
|
List of numeric values. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The mode. |
Usage Example
MODE([1, 2, 2, 3]) 2.0
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
MODE_MULT(values: List[Union[float, int]]) -> List[float]
¶
Returns a vertical array of the most frequently occurring values in a range.
Excel function: MODE.MULT (MODA.VARIOS in Spanish)
Description
Returns an array of the most frequently occurring, or repetitive values in an array or range of data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[Union[float, int]]
|
List of numeric values |
required |
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: List of most frequent values |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values or no repeated values |
Cost
O(n) - Linear time complexity
Usage
MODE_MULT([1, 2, 3, 3, 4, 4, 5]) [3.0, 4.0]
Source code in shortfx/fxExcel/statistic_formulas.py
MODE_SNGL(values: List[Union[float, int]]) -> float
¶
Returns the most common value in a data set.
Excel function: MODE.SNGL (MODA.UNO in Spanish) / MODE
Description
Returns the most frequently occurring value in a range or array of data. If multiple values have the same frequency, returns the first one found.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
List[Union[float, int]]
|
List of numeric values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The most frequent value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no numeric values or no repeated values |
Cost
O(n) - Linear time complexity
Usage
MODE_SNGL([1, 2, 3, 3, 4]) 3.0
Source code in shortfx/fxExcel/statistic_formulas.py
NEGBINOMDIST(number_f: int, number_s: int, probability_s: float) -> float
¶
Returns the negative binomial distribution (backward compat alias).
Usage Example
round(NEGBINOMDIST(10, 5, 0.25), 6) 0.055049
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
NEGBINOM_DIST(number_f: int, number_s: int, probability_s: float, cumulative: bool = False) -> float
¶
Returns the negative binomial distribution.
Excel function: NEGBINOM.DIST
Description
Returns the negative binomial distribution, the probability that there will be number_f failures before the number_s-th success, when the constant probability of a success is probability_s.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number_f
|
int
|
Number of failures |
required |
number_s
|
int
|
Threshold number of successes |
required |
probability_s
|
float
|
Probability of a success |
required |
cumulative
|
bool
|
If True, returns cumulative distribution function |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Negative binomial probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are out of valid range |
Cost
O(1) - Constant time
Usage
NEGBINOM_DIST(10, 5, 0.25) 0.055...
Source code in shortfx/fxExcel/statistic_formulas.py
NORMDIST(x: float, mean: float, standard_dev: float, cumulative: bool = True) -> float
¶
Returns the normal cumulative distribution (backward compat alias).
Usage Example
round(NORMDIST(42, 40, 1.5, True), 6) 0.908789
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
NORMINV(probability: float, mean: float, standard_dev: float) -> float
¶
Returns the inverse of the normal cumulative distribution (backward compat alias).
Usage Example
round(NORMINV(0.908789, 40, 1.5), 0) 42.0
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
NORMSDIST(z: float) -> float
¶
Returns the standard normal cumulative distribution (backward compat alias).
Usage Example
round(NORMSDIST(1.333333), 6) 0.908789
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
NORMSINV(probability: float) -> float
¶
Returns the inverse of the standard normal cumulative distribution (backward compat alias).
Usage Example
round(NORMSINV(0.908789), 6) 1.333333
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
NORM_DIST(x: float, mean: float, standard_dev: float, cumulative: bool = False) -> float
¶
Returns the normal cumulative distribution.
Excel function: NORM.DIST (DISTR.NORM.N in Spanish)
Description
Returns the normal distribution for the specified mean and standard deviation. Can return either cumulative distribution or probability density.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value for which to calculate the distribution |
required |
mean
|
float
|
Arithmetic mean of the distribution |
required |
standard_dev
|
float
|
Standard deviation of the distribution |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Normal distribution value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If standard_dev <= 0 |
Cost
O(1) - Constant time
Usage
NORM_DIST(42, 40, 1.5, True) 0.908...
Source code in shortfx/fxExcel/statistic_formulas.py
NORM_INV(probability: float, mean: float, standard_dev: float) -> float
¶
Returns the inverse of the normal cumulative distribution.
Excel function: NORM.INV (DISTR.NORM.INV in Spanish)
Description
Returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability corresponding to the normal distribution |
required |
mean
|
float
|
Arithmetic mean of the distribution |
required |
standard_dev
|
float
|
Standard deviation of the distribution |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Value for which the cumulative distribution equals probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If probability not in (0,1) or standard_dev <= 0 |
Cost
O(1) - Constant time
Usage
NORM_INV(0.908789, 40, 1.5) 42.000...
Source code in shortfx/fxExcel/statistic_formulas.py
NORM_S_DIST(z: float, cumulative: bool = False) -> float
¶
Returns the standard normal cumulative distribution.
Excel function: NORM.S.DIST (DISTR.NORM.ESTAND.N in Spanish)
Description
Returns the standard normal distribution (mean=0, std dev=1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
z
|
float
|
Value for which to calculate the distribution |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Standard normal distribution value |
Cost
O(1) - Constant time
Usage
NORM_S_DIST(1.333333) 0.181...
Source code in shortfx/fxExcel/statistic_formulas.py
NORM_S_INV(probability: float) -> float
¶
Returns the inverse of the standard normal cumulative distribution.
Excel function: NORM.S.INV (INV.NORM.ESTAND in Spanish)
Description
Returns the inverse of the standard normal cumulative distribution. The distribution has a mean of zero and a standard deviation of one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability corresponding to the normal distribution |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Z-value for which the cumulative distribution equals probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If probability not in (0,1) |
Cost
O(1) - Constant time
Usage
NORM_S_INV(0.908789) 1.333...
Source code in shortfx/fxExcel/statistic_formulas.py
PEARSON(array1: List[float], array2: List[float]) -> float
¶
Returns the Pearson product-moment correlation coefficient.
Identical to CORREL. Measures the linear relationship between two data sets, returning a value between -1 and 1.
Excel function: PEARSON
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[float]
|
First array of values. |
required |
array2
|
List[float]
|
Second array of values. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Pearson correlation coefficient between -1 and 1. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or less than 2 elements. |
Usage Example
round(PEARSON([1, 2, 3, 4, 5], [2, 4, 6, 8, 10]), 10) 1.0 round(PEARSON([1, 2, 3], [3, 1, 2]), 6) -0.5
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTILE(array: List[Union[float, int]], k: float) -> float
¶
Returns the k-th percentile (backward compat alias).
Excel function: PERCENTILE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
List of numeric values. |
required |
k
|
float
|
Percentile (0..1). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The percentile value. |
Usage Example
PERCENTILE([1, 2, 3, 4], 0.5) 2.5
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTILE_EXC(array: List[Union[float, int]], k: float) -> float
¶
Returns the k-th percentile of values (k in range 0..1, exclusive).
Excel function: PERCENTILE.EXC (PERCENTIL.EXC in Spanish)
Description
Returns the k-th percentile of values in a range, where k is in the range 0..1, exclusive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of data |
required |
k
|
float
|
Percentile value in the range 0..1 (exclusive) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The k-th percentile |
Raises:
| Type | Description |
|---|---|
ValueError
|
If k not in valid range or array too small |
Cost
O(n log n) - Due to sorting
Usage
PERCENTILE_EXC([1, 2, 3, 4], 0.25) 1.25
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTILE_INC(array: List[Union[float, int]], k: float) -> float
¶
Returns the k-th percentile of values in a range.
Excel function: PERCENTILE.INC (PERCENTIL.INC in Spanish) / PERCENTILE
Description
Returns the k-th percentile of values in a range, where k is in the range 0..1, inclusive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of data |
required |
k
|
float
|
Percentile value in the range 0..1 (inclusive) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The k-th percentile |
Raises:
| Type | Description |
|---|---|
ValueError
|
If k not in valid range or array empty |
Cost
O(n log n) - Due to sorting
Usage
PERCENTILE_INC([1, 2, 3, 4], 0.3) 1.9
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTRANK(array: List[Union[float, int]], x: float, significance: int = 3) -> float
¶
Returns the percentage rank (backward compat alias).
Excel function: PERCENTRANK
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
List of numeric values. |
required |
x
|
float
|
The value to rank. |
required |
significance
|
int
|
Number of significant digits. |
3
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Percentage rank. |
Usage Example
PERCENTRANK([1, 2, 3, 4], 3) 0.667
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTRANK_EXC(array: List[Union[float, int]], x: float, significance: int = 3) -> float
¶
Returns the rank of a value as a percentage (0..1, exclusive).
Excel function: PERCENTRANK.EXC (RANGO.PERCENTIL.EXC in Spanish)
Description
Returns the rank of a value in a data set as a percentage of the data set, exclusive of 0 and 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array of data |
required |
x
|
float
|
Value for which to find the rank |
required |
significance
|
int
|
Number of significant digits (default 3) |
3
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Percentile rank |
Raises:
| Type | Description |
|---|---|
ValueError
|
If array is empty or x outside range |
Cost
O(n log n) - Due to sorting
Usage
PERCENTRANK_EXC([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 7) 0.667
Source code in shortfx/fxExcel/statistic_formulas.py
PERCENTRANK_INC(array: List[Union[float, int]], x: float, significance: int = 3) -> float
¶
Returns the percentage rank of a value in a data set.
Excel function: PERCENTRANK.INC (RANGO.PERCENTIL.INC in Spanish) / PERCENTRANK
Description
Returns the rank of a value in a data set as a percentage of the data set, inclusive of 0 and 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array of data |
required |
x
|
float
|
Value for which to find the rank |
required |
significance
|
int
|
Number of significant digits (default 3) |
3
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Percentile rank |
Raises:
| Type | Description |
|---|---|
ValueError
|
If array is empty or x outside range |
Cost
O(n log n) - Due to sorting
Usage
PERCENTRANK_INC([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 7) 0.667
Source code in shortfx/fxExcel/statistic_formulas.py
PERMUT(number: int, number_chosen: int) -> int
¶
Returns the number of permutations for a given number of objects.
Excel function: PERMUT (PERMUTACIONES in Spanish)
Description
Returns the number of permutations for a given number of items that can be selected from the total objects. A permutation is any set or subset of objects where internal order is significant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Total number of items |
required |
number_chosen
|
int
|
Number of items in each permutation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Number of permutations |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are invalid |
Cost
O(k) - where k is number_chosen
Usage
PERMUT(100, 3) 970200
Source code in shortfx/fxExcel/statistic_formulas.py
PERMUTATIONA(number: int, number_chosen: int) -> int
¶
Returns the number of permutations with repetition.
Excel function: PERMUTATIONA (PERMUTACIONES.A in Spanish)
Description
Returns the number of permutations for a given number of objects (with repetitions) that can be selected from the total objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
int
|
Total number of items |
required |
number_chosen
|
int
|
Number of items in each permutation |
required |
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Number of permutations with repetition |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are invalid |
Cost
O(k) - where k is number_chosen
Usage
PERMUTATIONA(3, 2) 9
Source code in shortfx/fxExcel/statistic_formulas.py
PHI(x: float) -> float
¶
Returns the value of the density function for a standard normal distribution.
Excel function: PHI (FI in Spanish)
Description
Returns the value of the probability density function for a standard normal distribution for a specified value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
The value for which you want the density of the standard normal distribution |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Density value |
Cost
O(1) - Constant time
Usage
PHI(0.75) 0.301...
Source code in shortfx/fxExcel/statistic_formulas.py
POISSON(x: int, mean: float, cumulative: bool = True) -> float
¶
Returns the Poisson distribution (backward compat alias).
Usage Example
round(POISSON(2, 5, True), 6) 0.124652
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
POISSON_DIST(x: int, mean: float, cumulative: bool = False) -> float
¶
Returns the Poisson distribution.
Excel function: POISSON.DIST (POISSON.DIST in Spanish)
Description
Returns the Poisson distribution. A common application is predicting the number of events over a specific time, such as the number of cars arriving at a toll plaza in 1 minute.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
int
|
Number of events |
required |
mean
|
float
|
Expected numeric value (lambda) |
required |
cumulative
|
bool
|
If True, returns cumulative distribution function |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Poisson probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If x < 0 or mean <= 0 |
Cost
O(1) - Constant time
Usage
POISSON_DIST(2, 5, False) 0.084...
Source code in shortfx/fxExcel/statistic_formulas.py
PROB(x_range: List[Union[float, int]], prob_range: List[float], lower_limit: Union[float, int], upper_limit: Optional[Union[float, int]] = None) -> float
¶
Returns the probability that values fall within a range.
Excel function: PROB (PROBABILIDAD in Spanish)
Description
Returns the probability that values in x_range fall between lower_limit and upper_limit, given associated probabilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x_range
|
List[Union[float, int]]
|
Array of numeric values. |
required |
prob_range
|
List[float]
|
Array of probabilities associated with x_range values. |
required |
lower_limit
|
Union[float, int]
|
Lower bound of the interval. |
required |
upper_limit
|
Optional[Union[float, int]]
|
Upper bound (defaults to lower_limit for exact match). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sum of probabilities for values within the limits. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays differ in length, probabilities are invalid, or no matching values found. |
Usage Example
PROB([0, 1, 2, 3], [0.1, 0.2, 0.3, 0.4], 2) 0.3 PROB([0, 1, 2, 3], [0.1, 0.2, 0.3, 0.4], 1, 3) 0.9
Cost: O(n) — single pass.
Source code in shortfx/fxExcel/statistic_formulas.py
QUARTILE(array: List[Union[float, int]], quart: int) -> float
¶
Returns the quartile of a data set (backward compat alias).
Excel function: QUARTILE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
List of numeric values. |
required |
quart
|
int
|
Quartile value (0 = min, 1 = 25th, 2 = median, 3 = 75th, 4 = max). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The quartile value. |
Usage Example
QUARTILE([1, 2, 3, 4], 2) 2.5
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
QUARTILE_EXC(array: List[Union[float, int]], quart: int) -> float
¶
Returns the quartile of a data set (exclusive of 0 and 4).
Excel function: QUARTILE.EXC (CUARTIL.EXC in Spanish)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of numeric data. |
required |
quart
|
int
|
Quartile to return (1, 2, or 3). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The requested quartile value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If quart is not 1, 2, or 3, or array is empty. |
Usage Example
QUARTILE_EXC([1, 2, 3, 4, 5, 6, 7, 8], 1) 2.25
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
QUARTILE_INC(array: List[Union[float, int]], quart: int) -> float
¶
Returns the quartile of a data set (inclusive of 0 and 4).
Excel function: QUARTILE.INC (CUARTIL.INC in Spanish) / QUARTILE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of numeric data. |
required |
quart
|
int
|
Quartile to return (0 = min, 1 = Q1, 2 = median, 3 = Q3, 4 = max). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The requested quartile value. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If quart is not in 0..4, or array is empty. |
Usage Example
QUARTILE_INC([1, 2, 3, 4], 2) 2.5
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
RANK(number: Union[float, int], ref: List[Union[float, int]], order: int = 0) -> int
¶
Returns the rank of a number in a list (backward compatibility alias for RANK.EQ).
Excel function: RANK
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
Union[float, int]
|
Value whose rank you want to find. |
required |
ref
|
List[Union[float, int]]
|
List of numeric values. |
required |
order
|
int
|
0 = descending, nonzero = ascending. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Rank of the number within the list. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If number is not found in ref. |
Usage Example
RANK(3, [7, 3, 5, 1]) 3
Cost: O(n log n)
Source code in shortfx/fxExcel/statistic_formulas.py
RANK_AVG(number: Union[float, int], ref: List[Union[float, int]], order: int = 0) -> float
¶
Returns the rank of a number in a list, averaging for ties.
Excel function: RANK.AVG (JERARQUIA.MEDIA in Spanish)
Description
Returns the rank of a number within a list. Duplicate values receive the average of their positions (fractional ranking).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
Union[float, int]
|
Value whose rank you want to find. |
required |
ref
|
List[Union[float, int]]
|
List of numeric values (the reference). |
required |
order
|
int
|
0 = descending (largest is rank 1), nonzero = ascending (smallest is rank 1). |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Average rank of the number within the list. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If number is not found in ref or ref is empty. |
Usage Example
RANK_AVG(3, [7, 3, 3, 1]) 2.5 RANK_AVG(1, [7, 3, 3, 1], order=1) 1.0
Cost: O(n log n) — due to sorting.
Source code in shortfx/fxExcel/statistic_formulas.py
RANK_EQ(number: Union[float, int], ref: List[Union[float, int]], order: int = 0) -> int
¶
Returns the rank of a number in a list. Duplicate values receive the same rank.
Excel function: RANK.EQ (JERARQUIA.EQV in Spanish)
Description
Returns the rank of a number within a list. If more than one value has the same rank, the top rank of that set is returned (like a competition ranking).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
number
|
Union[float, int]
|
Value whose rank you want to find. |
required |
ref
|
List[Union[float, int]]
|
List of numeric values (the reference). |
required |
order
|
int
|
0 = descending (largest is rank 1), nonzero = ascending (smallest is rank 1). |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
int |
int
|
Rank of the number within the list. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If number is not found in ref or ref is empty. |
Usage Example
RANK_EQ(3, [7, 3, 3, 1]) 2 RANK_EQ(1, [7, 3, 3, 1], order=1) 1
Cost: O(n log n) — due to sorting.
Source code in shortfx/fxExcel/statistic_formulas.py
RSQ(known_y: List[float], known_x: List[float]) -> float
¶
Returns the R-squared value of the linear regression line.
Excel function: RSQ (COEFICIENTE.R2 in Spanish)
Description
Calculates the square of the Pearson correlation coefficient, representing the proportion of variance in known_y explained by known_x through linear regression.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Array of dependent data points. |
required |
known_x
|
List[float]
|
Array of independent data points. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
R-squared value between 0 and 1. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or fewer than 2 points. |
Usage Example
RSQ([2, 3, 9, 1, 8], [6, 5, 11, 7, 5]) 0.05795...
Cost: O(n) — single pass correlation.
Source code in shortfx/fxExcel/statistic_formulas.py
SKEW(*values: Union[float, int, List]) -> float
¶
Returns the skewness of a distribution.
Excel function: SKEW (COEFICIENTE.ASIMETRIA in Spanish)
Description
Returns the skewness of a distribution. Skewness characterizes the degree of asymmetry of a distribution around its mean. Positive skewness indicates a distribution with an asymmetric tail extending toward more positive values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists for which you want to calculate skewness |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Skewness value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 3 values provided |
Cost
O(n) - Linear time complexity
Usage
SKEW(3, 4, 5, 2, 3, 4, 5, 6, 4, 7) 0.359...
Source code in shortfx/fxExcel/statistic_formulas.py
SKEW_P(*values: Union[float, int, List]) -> float
¶
Returns the skewness of a distribution based on a population.
Excel function: SKEW.P (COEFICIENTE.ASIMETRIA.P in Spanish)
Description
Returns the skewness of a distribution based on a population: a characterization of the degree of asymmetry of a distribution around its mean.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists for which you want to calculate population skewness |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population skewness value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 3 values provided |
Cost
O(n) - Linear time complexity
Usage
SKEW_P(3, 4, 5, 2, 3, 4, 5, 6, 4, 7) 0.303...
Source code in shortfx/fxExcel/statistic_formulas.py
SLOPE(known_y: List[float], known_x: Optional[List[float]] = None) -> float
¶
Returns the slope of the linear regression line.
Excel function: SLOPE
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Slope value |
Cost
O(n) - Linear time complexity
Usage
SLOPE([2, 3, 9, 1, 8], [6, 5, 11, 7, 5]) 0.305...
Source code in shortfx/fxExcel/statistic_formulas.py
SMALL(array: List[Union[float, int]], k: int) -> float
¶
Returns the k-th smallest value in a data set.
Excel function: SMALL (K.ESIMO.MENOR in Spanish)
Description
Returns the k-th smallest value in a data set. Use this function to return values with a particular relative standing in a data set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of numerical data |
required |
k
|
int
|
Position (from the smallest value) in the array or range |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The k-th smallest value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If k is invalid or array is empty |
Cost
O(n log n) - Due to sorting
Usage
SMALL([3, 4, 5, 2, 3, 4, 6, 4, 7], 4) 4
Source code in shortfx/fxExcel/statistic_formulas.py
STANDARDIZE(x: float, mean: float, standard_dev: float) -> float
¶
Returns a normalized value from a distribution.
Excel function: STANDARDIZE (NORMALIZACION in Spanish)
Description
Returns a normalized value from a distribution characterized by a mean and standard deviation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value to normalize |
required |
mean
|
float
|
Arithmetic mean of the distribution |
required |
standard_dev
|
float
|
Standard deviation of the distribution |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Normalized value (z-score) |
Raises:
| Type | Description |
|---|---|
ValueError
|
If standard_dev <= 0 |
Cost
O(1) - Constant time
Usage
STANDARDIZE(42, 40, 1.5) 1.333...
Source code in shortfx/fxExcel/statistic_formulas.py
STDEV(*values: Union[float, int, List]) -> float
¶
Calculates standard deviation based on a sample (backward compat alias).
Excel function: STDEV
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numeric values or lists. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample standard deviation. |
Usage Example
STDEV(1, 2, 3, 4, 5) 1.5811...
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
STDEVA(*values: Union[float, int, str, bool, List]) -> float
¶
Estimates standard deviation based on a sample, including text and logical values.
Excel function: STDEVA (DESVESTA in Spanish)
Description
Estimates standard deviation based on a sample. Text and FALSE evaluate to 0; TRUE evaluates to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values to include in the sample |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample standard deviation |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 2 values provided |
Cost
O(n) - Linear time complexity
Usage
STDEVA(1345, 1301, 1368, True, False, "test") 623.79...
Source code in shortfx/fxExcel/statistic_formulas.py
STDEVP(*values: Union[float, int, List]) -> float
¶
Returns population standard deviation (backward compat alias).
Usage Example
round(STDEVP(1, 2, 3, 4, 5), 6) 1.414214
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
STDEVPA(*values: Union[float, int, str, bool, List]) -> float
¶
Calculates standard deviation based on population, including text and logical values.
Excel function: STDEVPA (DESVESTPA in Spanish)
Description
Calculates standard deviation based on the entire population. Text and FALSE evaluate to 0; TRUE evaluates to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values representing the population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population standard deviation |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values provided |
Cost
O(n) - Linear time complexity
Usage
STDEVPA(1345, 1301, 1368, True, False, "test") 590.69...
Source code in shortfx/fxExcel/statistic_formulas.py
STDEV_P(*values: Union[float, int, List]) -> float
¶
Calculates standard deviation based on the entire population.
Excel function: STDEV.P (DESVEST.P in Spanish)
Description
Calculates standard deviation based on the entire population given as arguments. Ignores logical values and text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists representing the population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population standard deviation |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 1 value provided |
Cost
O(n) - Linear time complexity
Usage
STDEV_P(1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299) 27.46...
Source code in shortfx/fxExcel/statistic_formulas.py
STDEV_S(*values: Union[float, int, List]) -> float
¶
Estimates standard deviation based on a sample.
Excel function: STDEV.S (DESVEST.M in Spanish) / STDEV
Description
Estimates standard deviation based on a sample. The standard deviation is a measure of how widely values are dispersed from the average value (the mean).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists representing a sample of a population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample standard deviation |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 2 values provided |
Cost
O(n) - Linear time complexity
Usage
STDEV_S(1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299) 29.05...
Source code in shortfx/fxExcel/statistic_formulas.py
STEYX(known_y: List[float], known_x: List[float]) -> float
¶
Returns the standard error of the predicted y-value for each x in the regression.
Excel function: STEYX (ERROR.TIPICO.XY in Spanish)
Description
Returns the standard error of the predicted y-value for each x in the regression. The standard error is a measure of the amount of error in the prediction of y for an individual x.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Array or range of dependent data points |
required |
known_x
|
List[float]
|
Array or range of independent data points |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Standard error of regression |
Raises:
| Type | Description |
|---|---|
ValueError
|
If arrays have different lengths or less than 3 points |
Cost
O(n) - Linear time complexity
Usage
STEYX([2, 3, 9, 1, 8], [6, 5, 11, 7, 5]) 3.305...
Source code in shortfx/fxExcel/statistic_formulas.py
TDIST(x: float, deg_freedom: int, tails: int = 2) -> float
¶
Returns the Student's t-distribution (backward compat alias).
Usage Example
round(TDIST(1.96, 60, 2), 4) 0.0546
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
TINV(probability: float, deg_freedom: int) -> float
¶
Returns the inverse of the two-tailed Student's t-distribution (backward compat alias).
Usage Example
round(TINV(0.054645, 60), 2) 1.96
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
TREND(known_y: List[float], known_x: Optional[List[float]] = None, new_x: Optional[List[float]] = None, const: bool = True) -> List[float]
¶
Returns values along a linear trend using least-squares regression.
Excel function: TREND (TENDENCIA in Spanish)
Description
Calculates predicted y-values along a linear trend line fitted with the least-squares method.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
known_y
|
List[float]
|
Set of known y-values. |
required |
known_x
|
Optional[List[float]]
|
Set of known x-values (defaults to 1, 2, 3, ...). |
None
|
new_x
|
Optional[List[float]]
|
New x-values for which to predict y (defaults to known_x). |
None
|
const
|
bool
|
If True, calculate intercept normally; if False, force through origin. |
True
|
Returns:
| Type | Description |
|---|---|
List[float]
|
List[float]: Predicted y-values for each new_x point. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If known_y and known_x have different lengths. |
Usage Example
TREND([1, 2, 3, 4], [10, 20, 30, 40], [50, 60]) [5.0, 6.0]
Cost: O(n) — linear regression.
Source code in shortfx/fxExcel/statistic_formulas.py
TRIMMEAN(array: List[Union[float, int]], fraction: float) -> float
¶
Returns the mean of the interior of a data set.
Excel function: TRIMMEAN (MEDIA.ACOTADA in Spanish)
Description
Returns the mean of the interior portion of a data set. TRIMMEAN calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array or range of values to trim and average |
required |
fraction
|
float
|
Fractional number of data points to exclude (0 to 1) |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Trimmed mean |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fraction not in [0,1) or array too small |
Cost
O(n log n) - Due to sorting
Usage
TRIMMEAN([4, 5, 6, 7, 2, 3, 4, 5, 1, 2, 3], 0.2) 3.777...
Source code in shortfx/fxExcel/statistic_formulas.py
TTEST(array1: List[float], array2: List[float], tails: int = 2, test_type: int = 2) -> float
¶
Returns the probability from a t-test (backward compat alias).
Usage Example
TTEST([3, 4, 5, 8, 9, 1, 2, 4, 5], [6, 19, 3, 2, 14, 4, 5, 17, 1], 2, 2) # doctest: +SKIP 0.196...
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
T_DIST(x: float, deg_freedom: int, cumulative: bool = False) -> float
¶
Returns the Student's t-distribution.
Excel function: T.DIST (DISTR.T.N in Spanish)
Description
Returns the left-tailed Student's t-distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Numeric value at which to evaluate the distribution |
required |
deg_freedom
|
int
|
Degrees of freedom |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
t-distribution value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If deg_freedom < 1 |
Cost
O(1) - Constant time
Usage
T_DIST(1.959999998, 60, True) 0.973...
Source code in shortfx/fxExcel/statistic_formulas.py
T_DIST_2T(x: float, deg_freedom: int) -> float
¶
Returns the two-tailed Student's t-distribution.
Excel function: T.DIST.2T (DISTR.T.2C in Spanish)
Description
Returns the two-tailed Student's t-distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Numeric value at which to evaluate the distribution (must be >= 0) |
required |
deg_freedom
|
int
|
Degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Two-tailed probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If x < 0 or deg_freedom < 1 |
Cost
O(1) - Constant time
Usage
T_DIST_2T(1.959999998, 60) 0.054...
Source code in shortfx/fxExcel/statistic_formulas.py
T_DIST_RT(x: float, deg_freedom: int) -> float
¶
Returns the right-tailed Student's t-distribution.
Excel function: T.DIST.RT (DISTR.T.CD in Spanish)
Description
Returns the right-tailed Student's t-distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Numeric value at which to evaluate the distribution |
required |
deg_freedom
|
int
|
Degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Right-tailed probability |
Raises:
| Type | Description |
|---|---|
ValueError
|
If deg_freedom < 1 |
Cost
O(1) - Constant time
Usage
T_DIST_RT(1.959999998, 60) 0.027...
Source code in shortfx/fxExcel/statistic_formulas.py
T_INV(probability: float, deg_freedom: int) -> float
¶
Returns the left-tailed inverse of the Student's t-distribution.
Excel function: T.INV (INV.T in Spanish)
Description
Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the t-distribution |
required |
deg_freedom
|
int
|
Degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
t-value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If probability not in (0,1) or deg_freedom < 1 |
Cost
O(1) - Constant time
Usage
T_INV(0.75, 2) 0.816...
Source code in shortfx/fxExcel/statistic_formulas.py
T_INV_2T(probability: float, deg_freedom: int) -> float
¶
Returns the two-tailed inverse of the Student's t-distribution.
Excel function: T.INV.2T (INV.T.2C in Spanish)
Description
Returns the t-value of the Student's t-distribution as a function of the probability and the degrees of freedom (two-tailed).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
probability
|
float
|
Probability associated with the two-tailed t-distribution |
required |
deg_freedom
|
int
|
Degrees of freedom |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
t-value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If probability not in (0,1) or deg_freedom < 1 |
Cost
O(1) - Constant time
Usage
T_INV_2T(0.05, 60) 2.000...
Source code in shortfx/fxExcel/statistic_formulas.py
T_TEST(array1: List[Union[float, int]], array2: List[Union[float, int]], tails: int = 2, test_type: int = 1) -> float
¶
Returns the probability associated with a Student's t-Test.
Excel function: T.TEST (PRUEBA.T.N in Spanish)
Description
Returns the p-value for a t-test. Used to determine whether two samples are likely to have come from the same two underlying populations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array1
|
List[Union[float, int]]
|
First data set |
required |
array2
|
List[Union[float, int]]
|
Second data set |
required |
tails
|
int
|
Number of distribution tails (1 or 2) |
2
|
test_type
|
int
|
Type of t-test (1=paired, 2=two-sample equal variance, 3=two-sample unequal variance) |
1
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
P-value from t-test |
Raises:
| Type | Description |
|---|---|
ValueError
|
If invalid parameters |
Cost
O(n) - Linear time complexity
Usage
T_TEST([3, 4, 5, 8, 9], [6, 19, 3, 2, 14], tails=2, test_type=1) 0.196...
Source code in shortfx/fxExcel/statistic_formulas.py
VAR(*values: Union[float, int, List]) -> float
¶
Calculates variance based on a sample (backward compat alias).
Excel function: VAR
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numeric values or lists. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample variance. |
Usage Example
VAR(1, 2, 3, 4, 5) 2.5
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
VARA(*values: Union[float, int, str, bool, List]) -> float
¶
Estimates variance based on a sample, including text and logical values.
Excel function: VARA
Description
Estimates variance based on a sample. Text and FALSE evaluate to 0; TRUE evaluates to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values to include in the sample |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample variance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 2 values provided |
Cost
O(n) - Linear time complexity
Usage
VARA(1345, 1301, 1368, True, False, "test") 389054.8
Source code in shortfx/fxExcel/statistic_formulas.py
VARP(*values: Union[float, int, List]) -> float
¶
Returns population variance (backward compat alias).
Usage Example
round(VARP(1, 2, 3, 4, 5), 1) 2.0
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
VARPA(*values: Union[float, int, str, bool, List]) -> float
¶
Calculates variance based on population, including text and logical values.
Excel function: VARPA
Description
Calculates variance based on the entire population. Text and FALSE evaluate to 0; TRUE evaluates to 1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, str, bool, List]
|
Values representing the population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population variance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If no values provided |
Cost
O(n) - Linear time complexity
Usage
VARPA(1345, 1301, 1368, True, False, "test") 348924.72...
Source code in shortfx/fxExcel/statistic_formulas.py
VAR_P(*values: Union[float, int, List]) -> float
¶
Calculates variance based on the entire population.
Excel function: VAR.P (VAR.P in Spanish)
Description
Calculates variance based on the entire population. Ignores logical values and text in the population.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists representing the population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Population variance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 1 value provided |
Cost
O(n) - Linear time complexity
Usage
VAR_P(1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299) 754.27...
Source code in shortfx/fxExcel/statistic_formulas.py
VAR_S(*values: Union[float, int, List]) -> float
¶
Estimates variance based on a sample.
Excel function: VAR.S (VAR.S in Spanish) / VAR
Description
Estimates variance based on a sample (ignores logical values and text).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*values
|
Union[float, int, List]
|
Numbers or lists representing a sample of a population |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Sample variance |
Raises:
| Type | Description |
|---|---|
ValueError
|
If less than 2 values provided |
Cost
O(n) - Linear time complexity
Usage
VAR_S(1345, 1301, 1368, 1322, 1310, 1370, 1318, 1350, 1303, 1299) 843.63...
Source code in shortfx/fxExcel/statistic_formulas.py
WEIBULL(x: float, alpha: float, beta: float, cumulative: bool = True) -> float
¶
Returns the Weibull distribution (backward compat alias).
Usage Example
round(WEIBULL(105, 20, 100, True), 6) 0.929581
Cost: O(1)
Source code in shortfx/fxExcel/statistic_formulas.py
WEIBULL_DIST(x: float, alpha: float, beta: float, cumulative: bool = False) -> float
¶
Returns the Weibull distribution.
Excel function: WEIBULL.DIST (DISTR.WEIBULL in Spanish)
Description
Returns the Weibull distribution. Use this distribution in reliability analysis, such as calculating a device's mean time to failure.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float
|
Value at which to evaluate the function (must be >= 0) |
required |
alpha
|
float
|
Shape parameter (must be > 0) |
required |
beta
|
float
|
Scale parameter (must be > 0) |
required |
cumulative
|
bool
|
If True, returns CDF; if False, returns PDF |
False
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
Weibull distribution value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If parameters are out of valid range |
Cost
O(1) - Constant time
Usage
WEIBULL_DIST(105, 20, 100, True) 0.929...
Source code in shortfx/fxExcel/statistic_formulas.py
ZTEST(array: List[float], x: float, sigma: Optional[float] = None) -> float
¶
Returns the one-tailed probability-value of a z-test (backward compat alias).
Usage Example
ZTEST([3, 6, 7, 8, 6, 5, 4, 2, 1, 9], 4) # doctest: +SKIP 0.090...
Cost: O(n)
Source code in shortfx/fxExcel/statistic_formulas.py
Z_TEST(array: List[Union[float, int]], x: float, sigma: Optional[float] = None) -> float
¶
Returns the one-tailed P-value of a z-test.
Excel function: Z.TEST (PRUEBA.Z.N in Spanish)
Description
Returns the one-tailed P-value of a z-test. For a given hypothesized population mean, returns the probability that the sample mean would be greater than the average of observations in the data set.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array
|
List[Union[float, int]]
|
Array of data to test |
required |
x
|
float
|
Value to test |
required |
sigma
|
Optional[float]
|
Optional population standard deviation (if None, uses sample std dev) |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
One-tailed P-value |
Raises:
| Type | Description |
|---|---|
ValueError
|
If array has less than 2 values |
Cost
O(n) - Linear time complexity
Usage
Z_TEST([3, 6, 7, 8, 6, 5, 4, 2, 1, 9], 4) 0.863...