Statistics¶
These functions compute statistical summaries and hypothesis tests.
mean¶
Computes the arithmetic mean of a list of numbers.
Parameters:
list- A list of numbers
Returns: The mean value.
median¶
Computes the median (middle value) of a list of numbers.
Parameters:
list- A list of numbers
Returns: The median value.
variance¶
Computes the sample variance of a list of numbers (using ddof=1).
Parameters:
list- A list of numbers
Returns: The sample variance.
standard_deviation¶
Computes the sample standard deviation of a list of numbers.
Parameters:
list- A list of numbers
Returns: The sample standard deviation.
percentile¶
Computes the p-th percentile of a list of numbers.
Parameters:
list- A list of numbersp- Percentile value between 0 and 100
Returns: The value at the specified percentile.
confidence_interval¶
Computes a confidence interval for the mean of a list of numbers.
Parameters:
list- A list of numbersconfidence_level- Confidence level between 0 and 1 (default:0.95)
Returns: A record with three fields:
"lower"- Lower bound of the interval"upper"- Upper bound of the interval"mean"- The sample mean
paired_t_test¶
Computes a paired t-test statistic.
Parameters:
mean_diff- Mean of the paired differencesstd- Standard deviation of the paired differencesnum_samples- Number of paired samples
Returns: The t-statistic.
t_test_p_value¶
Computes a p-value from a t-statistic.
Parameters:
t_statistic- The t-statistic valuenum_samples- Number of samples (used to compute degrees of freedom)
Returns: The two-tailed p-value.