This is the statistics Reference Manual, version 1.3.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 07:46:54 2024 GMT+0.
The main system appears first, followed by any subsystem dependency.
statistics
A consolidated system of statistical functions
Consolidated Common Lisp statistical functions
Steve Nunez <steve@symbolics.tech>
(GIT https://github.com/Lisp-Stat/statistics.git)
MS-PL
This system is a consolidation of three Common Lisp statistics libraries:
- Tamas Papp’s library, focusing on central moments
- Larry Hunters general statistical library
- Gary Warren King’s (GWK) general statistical library, cl-mathstats
As of Q3 2022, CL-MATHSTATS is usable with Lisp-Stat, but not incorporated. This is due to it being rather deeply embedded into its own ecosystem of utilities libraries (metatilities-base and cl-containers and the lift test framework) that have in some cases been superseded by alexandria, anaphora or numerical-utilities. In short, we recommend using CL-MATHSTATS when you need to, recognising that you’ll be hauling in a parallel system of math, statistics and utilities. Long term, we’re working to port CL-MATHSTATS on a case-by-case basis.
1.3.0
anaphora
(system).
alexandria
(system).
distributions
(system).
let-plus
(system).
num-utils
(system).
org.tfeb.conduit-packages
(system).
license
(file).
lh-statistics.lisp
(file).
nu-statistics.lisp
(file).
ls-statistics.lisp
(file).
pkgdcl.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
statistics/statistics.asd
statistics/lh-statistics.lisp
statistics/nu-statistics.lisp
statistics/ls-statistics.lisp
statistics/pkgdcl.lisp
statistics/lh-statistics.lisp
statistics
(system).
bin-and-count
(function).
binomial-cumulative-probability
(function).
binomial-ge-probability
(function).
binomial-probability
(function).
binomial-probability-ci
(function).
binomial-test-one-sample
(function).
binomial-test-one-sample-sse
(function).
binomial-test-paired-sse
(function).
binomial-test-two-sample
(function).
binomial-test-two-sample-sse
(function).
chi-square
(function).
chi-square-cdf
(function).
chi-square-test-for-trend
(function).
chi-square-test-one-sample
(function).
chi-square-test-rxc
(function).
choose
(function).
coefficient-of-variation
(function).
convert-to-standard-normal
(function).
correlation-coefficient
(function).
correlation-sse
(function).
correlation-test-two-sample
(function).
correlation-test-two-sample-on-sequences
(function).
f-significance
(function).
f-test
(function).
false-discovery-correction
(function).
fisher-exact-test
(function).
fisher-z-transform
(function).
geometric-mean
(function).
linear-regression
(function).
mcnemars-test
(function).
mean
(function).
mean-sd-n
(function).
median
(function).
mode
(function).
normal-mean-ci
(function).
normal-mean-ci-on-sequence
(function).
normal-pdf
(function).
normal-sd-ci
(function).
normal-sd-ci-on-sequence
(function).
normal-variance-ci
(function).
normal-variance-ci-on-sequence
(function).
percentile
(function).
permutations
(function).
phi
(function).
poisson-cumulative-probability
(function).
poisson-ge-probability
(function).
poisson-mu-ci
(function).
poisson-probability
(function).
poisson-test-one-sample
(function).
random-normal
(function).
random-pick
(function).
round-float
(function).
sample-range
(function).
sd
(function).
sign-test
(function).
sign-test-on-sequences
(function).
spearman-rank-correlation
(function).
square
(macro).
standard-deviation
(function).
standard-error-of-the-mean
(function).
t-distribution
(function).
t-significance
(function).
t-test-one-sample
(function).
t-test-one-sample-on-sequence
(function).
t-test-one-sample-sse
(function).
t-test-paired
(function).
t-test-paired-on-sequences
(function).
t-test-paired-sse
(function).
t-test-two-sample
(function).
t-test-two-sample-on-sequences
(function).
t-test-two-sample-sse
(function).
test-variables
(macro).
variance
(function).
wilcoxon-signed-rank-test
(function).
wilcoxon-signed-rank-test-on-sequences
(function).
z
(function).
z-test
(function).
z-test-on-sequence
(function).
average-rank
(function).
beta-incomplete
(function).
binomial-le-probability
(function).
error-function
(function).
error-function-complement
(function).
factorial
(function).
find-critical-value
(function).
gamma-incomplete
(function).
gamma-ln
(function).
round-up
(function).
safe-exp
(function).
sign
(function).
underflow-goes-to-zero
(macro).
statistics/nu-statistics.lisp
statistics
(system).
*central-sample-moments-default-degree*
(special variable).
add
(generic function).
as-alist
(method).
central-m2
(generic function).
central-m3
(generic function).
central-m4
(generic function).
central-sample-moments
(generic function).
central-sample-moments
(structure).
central-sample-moments-degree
(function).
cross-tabulate
(function).
empirical-quantile
(function).
empirical-quantile-probabilities
(function).
empty-accumulator
(condition).
ensure-sorted-reals
(generic function).
ensure-sorted-vector
(function).
information-not-collected-in-accumulator
(condition).
kurtosis
(generic function).
make-sparse-counter
(function).
mean
(generic function).
median
(generic function).
not-enough-elements-in-accumulator
(condition).
num=
(method).
pool
(function).
print-object
(method).
print-object
(method).
quantile
(generic function).
quantiles
(generic function).
sd
(generic function).
skewness
(generic function).
sorted-reals
(structure).
sorted-reals-elements
(function).
sparse-counter
(structure).
sparse-counter-count
(function).
sparse-counter-table
(reader).
tabulate
(function).
tally
(generic function).
variance
(generic function).
weighted-quantiles
(function).
&sorted-reals
(macro).
&sorted-reals-r/o
(macro).
central-sample-moments-m
(reader).
(setf central-sample-moments-m)
(writer).
central-sample-moments-p
(function).
central-sample-moments-s2
(reader).
(setf central-sample-moments-s2)
(writer).
central-sample-moments-s3
(reader).
(setf central-sample-moments-s3)
(writer).
central-sample-moments-s4
(reader).
(setf central-sample-moments-s4)
(writer).
central-sample-moments-w
(function).
(setf central-sample-moments-w)
(function).
copy-central-sample-moments
(function).
copy-sorted-reals
(function).
copy-sparse-counter
(function).
copy-tally-mixin
(function).
define-central-sample-moment
(macro).
make-central-sample-moments
(function).
make-sorted-reals
(function).
make-sparse-counter%
(function).
make-tally-mixin
(function).
pool2
(generic function).
sort-reals
(function).
sorted-reals-ordered-elements
(reader).
(setf sorted-reals-ordered-elements)
(writer).
sorted-reals-p
(function).
sorted-reals-unordered-elements
(reader).
(setf sorted-reals-unordered-elements)
(writer).
sparse-counter-p
(function).
tally-mixin
(structure).
tally-mixin-p
(function).
tally-mixin-w
(reader).
(setf tally-mixin-w)
(writer).
weighted-empirical-quantile
(function).
weighted-quantile-p-table
(function).
statistics/ls-statistics.lisp
statistics
(system).
fivenum
(function).
interquartile-range
(function).
mean
(function).
scale
(function).
variance
(function).
Packages are listed by definition order.
lh.statistics
The formulas and methods used are largely taken from Bernard Rosner, *Fundamentals of Biostatistics* 5th Edition. ’Rosner x’ is a page number. Some numeric functions were taken from CLASP, a 1994 common lisp package that implemented some of the statistical functions from *Numeric recipes in C* For CLASP functions, see copyright notice below.
These abreviations used in function and variable names:
ci = confidence interval
cdf = cumulative density function
ge = greater than or equal to
le = less than or equal to
pdf = probability density function
sd = standard deviation
rxc = rows by columns
sse = sample size estimate
common-lisp
.
bin-and-count
(function).
binomial-cumulative-probability
(function).
binomial-ge-probability
(function).
binomial-probability
(function).
binomial-probability-ci
(function).
binomial-test-one-sample
(function).
binomial-test-one-sample-sse
(function).
binomial-test-paired-sse
(function).
binomial-test-two-sample
(function).
binomial-test-two-sample-sse
(function).
chi-square
(function).
chi-square-cdf
(function).
chi-square-test-for-trend
(function).
chi-square-test-one-sample
(function).
chi-square-test-rxc
(function).
choose
(function).
coefficient-of-variation
(function).
convert-to-standard-normal
(function).
correlation-coefficient
(function).
correlation-sse
(function).
correlation-test-two-sample
(function).
correlation-test-two-sample-on-sequences
(function).
f-significance
(function).
f-test
(function).
false-discovery-correction
(function).
fisher-exact-test
(function).
fisher-z-transform
(function).
geometric-mean
(function).
linear-regression
(function).
mcnemars-test
(function).
mean
(function).
mean-sd-n
(function).
median
(function).
mode
(function).
normal-mean-ci
(function).
normal-mean-ci-on-sequence
(function).
normal-pdf
(function).
normal-sd-ci
(function).
normal-sd-ci-on-sequence
(function).
normal-variance-ci
(function).
normal-variance-ci-on-sequence
(function).
percentile
(function).
permutations
(function).
phi
(function).
poisson-cumulative-probability
(function).
poisson-ge-probability
(function).
poisson-mu-ci
(function).
poisson-probability
(function).
poisson-test-one-sample
(function).
random-normal
(function).
random-pick
(function).
round-float
(function).
sample-range
(function).
sd
(function).
sign-test
(function).
sign-test-on-sequences
(function).
spearman-rank-correlation
(function).
square
(macro).
standard-deviation
(function).
standard-error-of-the-mean
(function).
t-distribution
(function).
t-significance
(function).
t-test-one-sample
(function).
t-test-one-sample-on-sequence
(function).
t-test-one-sample-sse
(function).
t-test-paired
(function).
t-test-paired-on-sequences
(function).
t-test-paired-sse
(function).
t-test-two-sample
(function).
t-test-two-sample-on-sequences
(function).
t-test-two-sample-sse
(function).
test-variables
(macro).
variance
(function).
wilcoxon-signed-rank-test
(function).
wilcoxon-signed-rank-test-on-sequences
(function).
z
(function).
z-test
(function).
z-test-on-sequence
(function).
average-rank
(function).
beta-incomplete
(function).
binomial-le-probability
(function).
error-function
(function).
error-function-complement
(function).
factorial
(function).
find-critical-value
(function).
gamma-incomplete
(function).
gamma-ln
(function).
round-up
(function).
safe-exp
(function).
sign
(function).
underflow-goes-to-zero
(macro).
ls.statistics
common-lisp
.
let-plus
.
fivenum
(function).
interquartile-range
(function).
mean
(function).
scale
(function).
variance
(function).
nu.statistics
alexandria
.
anaphora
.
common-lisp
.
let-plus
.
num-utils.arithmetic
.
num-utils.num=
.
num-utils.utilities
.
*central-sample-moments-default-degree*
(special variable).
add
(generic function).
central-m2
(generic function).
central-m3
(generic function).
central-m4
(generic function).
central-sample-moments
(generic function).
central-sample-moments
(structure).
central-sample-moments-degree
(function).
cross-tabulate
(function).
empirical-quantile
(function).
empirical-quantile-probabilities
(function).
empty-accumulator
(condition).
ensure-sorted-reals
(generic function).
ensure-sorted-vector
(function).
information-not-collected-in-accumulator
(condition).
kurtosis
(generic function).
make-sparse-counter
(function).
mean
(generic function).
median
(generic function).
not-enough-elements-in-accumulator
(condition).
pool
(function).
quantile
(generic function).
quantiles
(generic function).
sd
(generic function).
skewness
(generic function).
sorted-reals
(structure).
sorted-reals-elements
(function).
sparse-counter
(structure).
sparse-counter-count
(function).
sparse-counter-table
(reader).
tabulate
(function).
tally
(generic function).
variance
(generic function).
weighted-quantiles
(function).
&sorted-reals
(macro).
&sorted-reals-r/o
(macro).
central-sample-moments-m
(reader).
(setf central-sample-moments-m)
(writer).
central-sample-moments-p
(function).
central-sample-moments-s2
(reader).
(setf central-sample-moments-s2)
(writer).
central-sample-moments-s3
(reader).
(setf central-sample-moments-s3)
(writer).
central-sample-moments-s4
(reader).
(setf central-sample-moments-s4)
(writer).
central-sample-moments-w
(function).
(setf central-sample-moments-w)
(function).
copy-central-sample-moments
(function).
copy-sorted-reals
(function).
copy-sparse-counter
(function).
copy-tally-mixin
(function).
define-central-sample-moment
(macro).
make-central-sample-moments
(function).
make-sorted-reals
(function).
make-sparse-counter%
(function).
make-tally-mixin
(function).
pool2
(generic function).
sort-reals
(function).
sorted-reals-ordered-elements
(reader).
(setf sorted-reals-ordered-elements)
(writer).
sorted-reals-p
(function).
sorted-reals-unordered-elements
(reader).
(setf sorted-reals-unordered-elements)
(writer).
sparse-counter-p
(function).
tally-mixin
(structure).
tally-mixin-p
(function).
tally-mixin-w
(reader).
(setf tally-mixin-w)
(writer).
weighted-empirical-quantile
(function).
weighted-quantile-p-table
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Default degree for (weighted) central sample moments.
Make N equal width bins and count the number of elements of sequence that belong in each.
Return P(X<k) for X a binomial random variable with parameters n & p. Bionomial expecations for fewer than k events in N trials, each having probability p. This is also known as probability mass function (PMF), the probability of getting exactly k successes in n independent Bernoulli trials.
The probability of k or more occurances in N events, each with probability p.
Return P(X=k) for X a binomial random variable with parameters n & p. Binomial expectations for seeing k events in N trials, each having probability p. Use the Poisson approximation if N>100 and P<0.01.
Confidence intervals on a binomial probability. If a binomial probability of p has been observed in N trials, what is the 1-alpha confidence interval around p? Approximate (using normal theory approximation) when npq >= 10 unless told otherwise
The significance of a one sample test for the equality of an observed probability p-hat to an expected probability p under a binomial distribution with N observations. Use the normal theory approximation if n*p*(1-p) > 10 (unless the exact flag is true).
Returns the number of subjects needed to test whether an observed probability is significantly different from a particular binomial null hypothesis with a significance alpha and a power 1-beta.
Sample size estimate for the McNemar (discordant pairs) test. Pd is the projected proportion of discordant pairs among all pairs, and Pa is the projected proportion of type A pairs among discordant pairs. alpha, 1-beta and tails are as above. Returns the number of individuals necessary; that is twice the number of matched pairs necessary.
Are the observed probabilities of an event (p-hat1 and p-hat2) in N1/N2 trials different? The normal theory method implemented here. The exact test is Fisher’s contingency table method, below.
The number of subjects needed to test if two binomial probabilities are different at a given significance alpha and power 1-beta. The sample sizes can be unequal; the p2 sample is sample-sse-ratio * the size of the p1 sample. It can be a one tailed or two tailed test.
Return the degree of CENTRAL-SAMPLE-MOMENTS.
;; Returns the point which is the indicated percentile in the Chi Square distribution with dof degrees of freedom.
Chi-square-cdf computes the left hand tail area under the chi square distribution under dof degrees of freedom up to X.
This test works on a 2xk table and assesses if there is an increasing or decreasing trend. Arguments are equal sized lists counts. Optionally, provide a list of scores, which represent some numeric attribute of the group. If not provided, scores are assumed to be 1 to k.
The significance of a one sample Chi square test for the variance of a normal distribution. Variance is the observed variance, N is the number of observations, and sigma-squared is the test variance.
Takes contingency-table, an RxC array, and returns the significance of the relationship between the row variable and the column variable. Any difference in proportion will cause this test to be significant – consider using the test for trend instead if you are looking for a consistent change.
How may ways to take n things taken k at a time, when order doesn’t matter
Return coefficient of variation
Convert X from a Normal distribution with mean mu and variance sigma to standard normal
Pearson correlation
Returns the size of a sample necessary to find a correlation of expected value rho with significance alpha and power 1-beta.
Test if two correlation coefficients are different. Users Fisher’s Z test.
Cross-tabulate two sequences (using a SPARSE-COUNTER with the given TEST). TEST is used to compare conses.
Return the empirical quantile of a vector of real numbers, sorted in ascending order (not checked). Uses a 0.5 correction.
Probabilities that correspond to the empirical quantiles of a vector of length N. That is to say,
(== (quantiles sample (empirical-quantile-probabilities (length sample)))
sample)
for any vector SAMPLE.
Return the elements of OBJECT as a vector (or reals) sorted in ascending order.
Adopted from CLASP, but changed to handle F < 1 correctly in the one-tailed case. The ‘f-statistic’ must be a positive number. The degrees of freedom arguments must be positive integers. The ‘one-tailed-p’ argument is treated as a boolean.
F test for the equality of two variances
A multiple testing correction that is less conservative than Bonferroni. Takes a list of p-values and a false discovery rate, and returns the number of p-values that are likely to be good enough to reject the null at that rate. Returns a second value which is the p-value cutoff.
Fisher’s exact test. Gives a p value for a particular 2x2 contingency table
Transforms the correlation coefficient to an approximately normal distribution.
By default, returns the five number summary (min, 1st quartile, median, 3rd quartile, max) of the elements X. If the keyword :tukey is set to a non-nil value, Tukey’s fivenum summary is computed instead.
Returns the geometric mean of SEQUENCE
The geometric mean is a mean or average, which indicates the central tendency or typical value of a set of numbers by using the product of their values (as opposed to the arithmetic mean which uses their sum)
Returns the interquartile range of the elements of X.
Computes the regression equation for a least squares fit of a line to a sequence of points (each a list of two numbers, e.g. ’((1.0 0.1) (2.0 0.2))) and report the intercept, slope, correlation coefficient r, R^2, and the significance of the difference of the slope from 0.
Create a sparse counter. Elements are compared with TEST (should be accepted by HASH-TABLE).
McNemar’s test for correlated proportions, used for longitudinal studies. Look only at the number of discordant pairs (one treatment is effective and the other is not). If the two treatments are A and B, a-discordant-count is the number where A worked and B did not, and b-discordant-count is the number where B worked and A did not.
Returns the mean of SEQUENCE
Return the mean of OBJECT. OBJECT must be either a sequence of numbers, a sequence of BOOLEAN or a DISTRIBUTION object.
A sequence of BOOLEAN is converted to a BIT-VECTOR and the mean of it returned. This gives you the ratio of TRUE/FALSE values in the sequence (which is most often interpreted as a probability).
For samples (numeric-vectors), normalized by the weight-1 (and thus unbiased if certain assumptions hold, eg weights that count frequencies.
A combined calculation that is often useful. Takes a sequence and returns three values: mean, standard deviation and N.
Returns the median of SEQUENCE
Returns two values: a list of the modes and the number of times they occur
Confidence interval for the mean of a normal distribution.
The 1-alpha percent confidence interval on the mean of a normal distribution with parameters mean, sd & n.
The 1-alpha confidence interval on the mean of a sequence of numbers drawn from a Normal distribution.
The probability density function (PDF) for a normal distribution with mean mu and variance sigma at point x.
The 1-alpha confidence interval on the standard deviation of a sequence of numbers drawn from a Normal distribution.
The 1-alpha confidence interval on the variance of a sequence of numbers drawn from a Normal distribution.
Return an element from SEQUENCE at percentile PERCENT This function is also known as quantile.
How many ways to take n things taken k at a time, when order matters
the CDF of standard normal distribution
Probability of seeing fewer than K events over a time period when the expected number events over that time is mu.
Probability of X or more events when expected is mu.
Confidence interval for the Poisson parameter mu
Given x observations in a unit of time, what is the 1-alpha confidence interval on the Poisson parameter mu (= lambda*T)?
Since find-critical-value assumes that the function is monotonic increasing, adjust the value we are looking for taking advantage of reflectiveness
Probability of seeing k events over a time period when the expected number of events over that time is mu.
The significance of a one sample test for the equality of an observed number of events (observed) and an expected number mu under the poisson distribution. Normal theory approximation is not that great, so don’t use it unless told.
Pool ACCUMULATORS.
Returns a random number with mean and standard-distribution as specified.
Random selection from sequence
Rounds a floating point number to a specified number of digits precision.
Return the difference between the largest and smallest values in SEQUENCE
Return (x - x̄) / s where X̄ is the mean and S is the standard deviation
Modeled on the R scale function.
See https://stat.ethz.ch/R-manual/R-devel/library/base/html/scale.html
Really just a special case of the binomial one sample test with p = 1/2. The normal theory version has a correction factor to make it a better approximation.
Same as SIGN-TEST, but takes two sequences and tests whether the entries in one are different (greater or less) than the other.
Return the count for OBJECT.
Spearman rank correlation computes the relationship between a pair of variables when one or both are either ordinal or have a distribution that is far from normal. It takes a list of points (same format as linear-regression) and returns the spearman rank correlation coefficient and its significance.
Return the standard deviation of SEQUENCE
Return the estimated standard deviation obtained from a set of sample means from repeated samples
Returns the point which is the indicated percentile in the T distribution with dof degrees of freedom
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
The significance of a one sample T test for the mean of a normal distribution with unknown variance. X-bar is the observed mean, sd is the observed standard deviation, N is the number of observations and mu is the test mean.
The significance of a one sample T test for the mean of a normal sequence of numbers with unknown variance. X-bar is the observed mean, sd is the observed standard deviation, N is the number of observations and mu is the test mean.
Returns the number of subjects needed to test whether the mean of a normally distributed sample mu is different from a null hypothesis mean mu-null and variance variance, with alpha, 1-beta and tails as specified.
The significance of a paired t test for the means of two normal distributions in a longitudinal study. D-bar is the mean difference, sd is the standard deviation of the differences, N is the number of pairs.
The significance of a paired t test for means of two normal distributions in a longitudinal study. Before is a sequence of before values, after is the sequence of paired after values (which must be the same length as the before sequence).
Returns the number of subjects needed to test whether the differences with mean difference-mu and variance difference-variance, with alpha, 1-beta and tails as specified.
The significance of the difference of two means (x-bar1 and x-bar2) with standard deviations sd1 and sd2, and sample sizes n1 and n2 respectively. The form of the two sample t test depends on whether the sample variances are equal or not. If the variable variances-equal? is :test, then we use an F test and the variance-significance-cutoff to determine if they are equal. If the variances are equal, then we use the two sample t test for equal variances. If they are not equal, we use the Satterthwaite method, which has good type I error properties (at the loss of some power).
The significance of the difference of two means of SEQUENCE1 and SEQUENCE2 with standard deviations sd1 and sd2, and sample sizes n1 and n2 respectively. The form of the two sample t test depends on whether the sample variances are equal or not. If the variable variances-equal? is :test, then we use an F test and the variance-significance-cutoff to determine if they are equal. If the variances are equal, then we use the two sample t test for equal variances. If they are not equal, we use the Satterthwaite method.
Returns the number of subjects needed to test whether the mean mu1 of a normally distributed sample (with variance variance1) is different from a second sample with mean mu2 and variance variance2, with alpha, 1-beta and tails as specified. It is also possible to set a sample size ratio of sample 1 to sample 2.
Tabulate a sequence (using a SPARSE-COUNTER with the given TEST).
Return variance of SEQUENCE
Variance of OBJECT. For samples, normalized by the weight-1 (and thus unbiased if certain assumptions hold, e.g. weights that count frequencies).
Note that alexandria’s default for variance will return biased variance. We change that here for consistency. If you want a biased variance use alexandria:variance directly.
Calculate quantiles QS of weighted observations. Uses a 0.5 correction.
A test on the ranking of positive and negative differences (are the positive differences significantly larger/smaller than the negative ones). Assumes a continuous and symmetric distribution of differences, although not a normal one. This is the normal theory approximation, which is only valid when N > 15. This test is equivalent to the Mann-Whitney test.
The inverse normal function, P(X<Zu) = u where X is distributed as the standard normal. Uses binary search.(
The significance of a one sample Z test for the mean of a normal distribution with known variance. mu is the null hypothesis mean, x-bar is the observed mean, sigma is the standard deviation and N is the number of observations. If tails is :both, the significance of a difference between x-bar and mu. If tails is :positive, the significance of x-bar is greater than mu, and if tails is :negative, the significance of x-bar being less than mu. Returns a p value.
Add OBJECT to ACCUMULATOR. Return OBJECT. NILs are ignored by the accumulator, unless a specialized method decides otherwise. Keywords may be used to specify additional information (eg weight).
sparse-counter
) object &key weight) ¶Increments the count of OBJECT in SPARSE-COUNTER, optionally with a weight
sorted-reals
) object &key) ¶central-sample-moments
) (y real
) &key weight) ¶null
) &key) ¶Second central moment. For samples, normalized by the total weight (and thus not the unbiased estimator, see VARIANCE).
central-sample-moments
) &key weights) ¶Third central moment.
central-sample-moments
) &key weights) ¶Fourth central moment.
central-sample-moments
) &key weights) ¶Return a CENTRAL-SAMPLE-MOMENTS object that allows the calculation of the central sample moments of OBJECT up to the given DEGREE.
When WEIGHTS are given, they need to be a sequence of matching length.
null
) &key degree weights) ¶central-sample-moments
) &key degree weights) ¶sequence
) &key degree weights) ¶Return the contents of OBJECT as a SORTED-REALS.
sorted-reals
)) ¶array
)) ¶list
)) ¶Kurtosis FIXME talk about bias, maybe implement unbiased?
central-sample-moments
) &key weights) ¶The mean of elements in OBJECT.
central-sample-moments
) &key weights) ¶Median of OBJECT.
Return an element at quantile Q. May be an interpolation or an approximation, depending on OBJECT and Q. NOTE: Extensions should define methods for QUANTILES, not QUANTILE.
Multiple quantiles (see QUANTILE). NOTE: Extensions should define methods for QUANTILES, not QUANTILE.
sequence
) qs) ¶sorted-reals
) q) ¶Standard deviation. For samples, the square root of the unbiased estimator (see VARIANCE).
Skewness FIXME talk about bias, maybe implement unbiased?
central-sample-moments
) &key weights) ¶The total weight of elements in ACCUMULATOR.
sparse-counter
)) ¶Return the total ’weight’ of the accumulator
tally-mixin
)) ¶Variance of OBJECT. For samples, normalized by the weight-1 (and thus unbiased if certain assumptions hold, eg weights that count frequencies).
central-sample-moments
) &key weights) ¶sparse-counter
)) ¶Return (OBJECT . COUNT) pairs as an alist.
num-utils.utilities
.
central-sample-moments
) (b central-sample-moments
) &optional tolerance) ¶num-utils.num=
.
sparse-counter
) stream) ¶sorted-reals
) stream) ¶error
.
error
.
error
.
Central sample moments calculated on-line/single-pass.
M weighted mean
S2 weighted sum of squared deviations from the mean, not calculated when NIL
S3 weighted sum of cubed deviations from the mean, not calculated when NIL
S4 weighted sum of 4th power deviations from the mean, not calculated when NIL
Allows on-line, numerically stable calculation of moments. See cite{bennett2009numerically} and cite{pebay2008formulas} for the description of the algorithm. M_2, ..., M_4 in the paper are s2, ..., s4 in the code.
real
0.0d0
(or (real 0) null)
0.0d0
(or real null)
0.0d0
(or (real 0) null)
0.0d0
Accumulator which sorts elements. ELEMENTS return the sorted elements.
structure-object
.
add
.
as-alist
.
print-object
.
tally
.
hash-table
This slot is read-only.
LET+ form for slots of the structure SORTED-REALS.
LET+ form for slots of the structure SORTED-REALS. Read-only.
FIXME documentation, factor out general part
Protects against floating point underflow errors and sets the value to 0.0 instead.
Average rank calculation for non-parametric tests. Ranks are 1 based, but lisp is 0 based, so add 1!
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
m
.
s2
.
s3
.
s4
.
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
Adopted from CLASP 1.4.3, http://eksl-www.cs.umass.edu/clasp.html
Eliminates floating point underflow for the exponential function. Instead, it just returns 0.0d0
Return a SORTED-REALS structure.
w
.
Return the empirical quantile of a vector of real numbers, sorted in ascending order (not checked). Uses a 0.5 correction.
Return table of probability brackets for weighted quantile calculations., built from the weights (which should be positive reals, not checked). Uses a 0.5 correction.
Pool two accumulators. When they are of a different type, the resulting accumulator will be downgraded to the level afforded by the information available in the accumulators.
central-sample-moments
) (moments-b central-sample-moments
)) ¶Jump to: | &
(
A B C D E F G I K L M N P Q R S T U V W Z |
---|
Jump to: | &
(
A B C D E F G I K L M N P Q R S T U V W Z |
---|
Jump to: | *
M O S T U W |
---|
Jump to: | *
M O S T U W |
---|
Jump to: | C E F I L N P S T |
---|
Jump to: | C E F I L N P S T |
---|