The sapaclisp Reference Manual

This is the sapaclisp Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Feb 26 17:50:13 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 sapaclisp

Source

sapaclisp.asd.

Child Components

2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 sapaclisp/sapaclisp.asd

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

ASDF Systems

sapaclisp.

Packages

sapaclisp-asd.


2.1.2 sapaclisp/sapa-package.lisp

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Packages

sapa.


2.1.3 sapaclisp/hacks.lisp

Dependency

sapa-package.lisp (file).

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).


2.1.4 sapaclisp/utilities.lisp

Dependency

sapa-package.lisp (file).

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.5 sapaclisp/matrix.lisp

Dependency

sapa-package.lisp (file).

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface

2.1.6 sapaclisp/basic-math.lisp

Dependency

sapa-package.lisp (file).

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.7 sapaclisp/dft-and-fft.lisp

Dependency

utilities.lisp (file).

Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.8 sapaclisp/basic-statistics.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.9 sapaclisp/random.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.10 sapaclisp/tapers.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

bessi0-nr (function).


2.1.11 sapaclisp/filtering.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

which-is-faster? (function).


2.1.12 sapaclisp/acvs.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface

2.1.14 sapaclisp/multitaper.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.15 sapaclisp/nonparametric.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface
Internals

2.1.16 sapaclisp/harmonic.lisp

Dependencies
Source

sapaclisp.asd.

Parent Component

sapaclisp (system).

Public Interface

3 Packages

Packages are listed by definition order.


3.1 sapaclisp-asd

Source

sapaclisp.asd.

Use List
  • asdf/interface.
  • common-lisp.

3.2 sapa

Source

sapa-package.lisp.

Use List

common-lisp.

Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Macros

Macro: divf (place &optional delta)

Like <incf>

Package

sapa.

Source

utilities.lisp.

Macro: multf (place &optional delta)

Like <incf>

Package

sapa.

Source

utilities.lisp.


4.1.2 Ordinary functions

Function: 2d-matrix->linearized-upper-trangular (a &key result)

given
[1] A (required)
==> a 2d hermitian matrix
[2] result (keyword; new vector of appropriate size) <== a vector filled linearly with elements of A
converts 2d hermitian array into linearized form and returns
[1] result, a vector with 2d hermitian array stored in linearized form

Package

sapa.

Source

matrix.lisp.

Function: 2d-matrix-move! (from-this to-this)

given
[1] from-this (required)
==> a 2d matrix
[2] to-this (required)
<== another 2d matrix
transfer contents of from-this to corresponding locations in to-this, and
returns
[1] to-this

Package

sapa.

Source

matrix.lisp.

Function: a*x (a x)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
returns
[1] a vector of numbers obtained by multiplying each element of x by a
—-
Note: corresponds to SSCAL in LINPACK’s bla.

Package

sapa.

Source

utilities.lisp.

Function: a*x! (a x &key result)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
[2] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by multiplying each element of x by a
—-
Note: corresponds to SSCAL in LINPACK’s bla.

Package

sapa.

Source

utilities.lisp.

Function: a*x+b (a x b)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
[3] b (required)
==> a number
returns
[1] a vector of numbers obtained by multiplying each element of x by a and adding b

Package

sapa.

Source

utilities.lisp.

Function: a*x+b! (a x b &key result)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
[3] b (required)
==> a number
[4] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by multiplying each element of x by a and adding b

Package

sapa.

Source

utilities.lisp.

Function: a*x+y (a x y)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
[3] y (required)
==> a sequence of numbers
returns
[1] a vector of numbers obtained by multiplying each element of x by a and adding the corresponding element of y
—-
Note: corresponds to SAXPY in LINPACK’s bla.

Package

sapa.

Source

utilities.lisp.

Function: a*x+y! (a x y &key result)

given
[1] a (required)
==> a number
[2] x (required)
==> a sequence of numbers
[3] y (required)
==> a sequence of numbers
[4] result (keyword; y)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by multiplying each element of x by a and adding the corresponding element of y
—-
Note: corresponds to SAXPY in LINPACK’s bla.

Package

sapa.

Source

utilities.lisp.

Function: acvs (time-series &key start end center-data-p acs-p result)

given
[1] time-series (required)
==> a vector containing the time series
[2] start (keyword; 0)
==> start index of time-series to be used
[3] end (keyword; length of time-series)
==> 1 + end index of time-series to be used
[4] center-data-p (keyword; t)
==> if t, subtract sample mean of time series
prior to computing the acvs;
if nil, do not subtract the sample mean
[5] acs-p (keyword; nil)
==> return autocorrelation sequence
rather than autocovariance sequence
[6] result (keyword; vector of length n)
<== vector to hold acvs (or acs)
calculates autocovariance (or autocorrelation) sequence using fft’s and returns
[1] result, a vector with the sample acvs (or acs)
[2] sample variance of time series (with mean treated
as specified by center-data-p keyword)

Note: see Equations (191a) and (190b) of the SAPA book

Package

sapa.

Source

acvs.lisp.

Function: acvs-for-time-series-simulated-from-sdf (n-series sdf &key sampling-time n-total result)

given
[1] n-series (required)
==> length of time series simulated using simulate-time-series-from-sdf
(must be a power of 2)
[2] sdf (required)
==> spectral density function (sdf) defined for
0 <= f <= 1/(2.0 sampling-time) – the
sdf is assumed to be two-sided and symmetric about f = 0
[3] sampling-time (keyword; 1.0)
==> the assumed sampling time (delta t)
[4] n-total (keyword; 4 * next power of 2 for n-series) ==> a power of 2 controlling degree of accuracy
of the approximation (the larger, the better – see Percival, 1992, for details)
[5] result (keyword; vector of length n-series)
<== a vector to contain simulated time series returns
[1] a vector with the theoretical acvs from lag 0
to n-series - 1 for a time series generated via a call to simulate-time-series-from-sdf with n-series, sdf, sampling-time and n-total set to the same values

Package

sapa.

Source

random.lisp.

Function: add-sequences (&rest seqs)

given
[1] a arbitrary number of sequences of numbers, all of the same size
returns
[1] a new sequence formed by adding the sequences together on an element by element basis

Package

sapa.

Source

utilities.lisp.

Function: ar-coeffs->acvs (ar-coeffs variance max-lag &key process-variance-p list-of-lower-order-phi list-of-lower-order-pev result)

given
[1] AR-coeffs (required)
==> vector of length p with real or
complex-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[2] variance (required)
==> process variance (if process-variance-p is true)
or innovations variance (if nil)
[3] max-lag (required)
==> acvs to be computed out to this lag
[4] process-variance-p (keyword; t)
==> if true, required variance parameter
is taken to be process variance;
otherwise, it is taken to be the innovations
variance (both variance and process-variance-p
are ignored if the next two keyword parameters
are supplied)
[5] list-of-lower-order-phi (keyword; nil)
==> if supplied, bypasses call to step-down-Levinson-Durbin-recursions, in which case list-of-lower-order-pev must be supplied also
[6] list-of-lower-order-pev (keyword; nil)
==> if supplied, bypasses call to step-down-Levinson-Durbin-recursions [7] result (keyword; vector of size max-lag + 1)
<== vector to hold acvs for lags 0, 1, ..., max-lag
returns
[1] result, i.e., the acvs

Note: see Section 9.4 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: ar-coeffs->prewhitening-filter (ar-coeffs &key result)

given
[1] AR-coeffs (required)
==> a sequence of AR coefficients
phi_{1,p}, ..., phi_{p,p}
[2] result (keyword; vector of size (1+ (length AR-coeffs))) <== sequence to hold coefficients for prewhitening filter 1, -phi_{1,p}, ..., -phi_{p,p}
returns
[1] result, the prewhitening filter

Note: this filter can be used to compute
forward prediction errors; to obtain
the filter needed to compute
backward prediction errors,
reverse the elements in result; i.e.,
evaluate (reverse result)

Package

sapa.

Source

parametric.lisp.

Function: ar-coeffs->reflection-coeffs (ar-coeffs &key list-of-lower-order-phi result)

given
[1] AR-coeffs (required)
==> vector of length p with real or
complex-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[2] list-of-lower-order-phi (keyword; calls step-down-Levinson-Durbin-recursions) ==> must contain the list that is returned by
the function step-down-Levinson-Durbin-recursions;
this keyword parameter is useful if the result
of calling that function is already available
[3] results (keyword; vector of length p)
<== vector of size p into which
the reflection coefficients phi_{j,j}
of orders j = 1, 2, ..., p are placed
returns
[1] results, i.e., the reflection coefficients

Note: see Section 9.4 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: ar-coeffs->sdf (ar-coeffs innovations-variance &key n-nonzero-freqs sampling-time return-est-for-0-freq-p sdf-transformation result-sdf return-frequencies-p freq-transformation result-freq)

given
[1] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[2] innovations-variance (required)
==> innovations variance of the process
[3] N-nonzero-freqs (keyword; 256)
==> the number of nonzero frequencies at which the AR sdf
is to be computed (need NOT be a power of 2);
the first nonzero frequency (and also spacing
between frequencies) is given by
1/(2 * N-nonzero-freqs * sampling time)
= Nyquist frequency/N-nonzero-freqs;
the last nonzero frequency is the Nyquist frequency
[4] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[5] return-est-for-0-freq-p (keyword; t)
==> if t, sdf is computed at zero frequency;
otherwise, it is not computed.
[6] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[7] result-sdf (keyword; vector of correct length)
<== vector of length N-nonzero-freqs (if return-est-for-0-freq-p is nil) or N-nonzero-freqs +1 (if return-est-for-0-freq-p is t)
into which the properly transformed sdf is placed
[8] return-frequencies-p (keyword; nil)
==> if t, the frequencies associated with the transfer function
are computed and returned in result-freq
[9] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[10] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of length N-nonzero-freqs (if return-est-for-0-freq-p is nil) or N-nonzero-freqs +1 (if return-est-for-0-freq-p is t)
into which the frequencies associated with the values
in result-sdf are placed
returns
[1] result-sdf, a vector holding
the properly transformed sdf
[2] nil (if return-frequencies-p is nil) or
result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-sdf
[3] the length of the vector result-sdf

Note: see Equation (392b) of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: ar-coeffs->sdf-at-single-freq (ar-coeffs innovations-variance freq &key sampling-time sdf-transformation)

given
[1] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p} for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2} + ... + phi_{p,p} * x_{t-p} + e_t
[2] innovations-variance (required)
==> innovations variance of the process
[3] freq (required)
==> the single frequency at which the sdf is
to be computed
[4] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book) [6] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used to transform the value of the sdf at freq returns
[1] properly transformed AR sdf evaluated at freq
[2] nil (if return-frequencies-p is nil) or result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-sdf
[3] the length of the vector result-sdf

Note: see Equation (392b) of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: ar-coeffs->variance (ar-coeffs innovations-variance)

given
[1] AR-coeffs (required)
==> a sequence of AR coefficients phi_{1,p}, ..., phi_{p,p}
[2] innovations-variance (required)
==> innovations variance of the process returns
[1] variance of the process

Package

sapa.

Source

parametric.lisp.

Function: bandwidth&confidence-intervals-for-sdf-db (sdf-db freq sample-size &key confidence-level lag-window-function max-lag sampling-time c_h)

given
[1] sdf-dB (required)
==> an sdf estimate (in decibels) for a single frequency
[2] freq (required)
==> the frequency associated with sdf-dB
[3] sampling-size (required)
==> the sample size of the time series
from which sdf-dB was computed
[4] confidence-level (keyword; 0.95)
==> the level of the confidence interval
(e.g., 0.95 yields a 95% confidence interval)
[5] lag-window-function (keyword; nil)
==> the lag window function used to create
sdf-dB (nil means a lag window function was NOT used) [6] max-lag (keyword; sample-size - 1)
==> the maximum lag used in conjunction with lag-window-function to create sdf-dB (not used in lag-window-function is nil) [7] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[8] C_h (keyword; 1.0)
==> the variance inflation factor due to tapering
(see Table 248 of the SAPA book); the default value
of 1.0 is appropriate for a rectangular data taper returns
[1] left-hand size of interval describing the bandwidth of
the spectral estimate (interval is centered on freq)
[2] right-hand size of bandwidth interval
[3] lower limit (in decibels) of confidence interval for
true sdf based upon sdf-dB
[4] upper limit (in decibels) of confidence interval

Note: see Sections 6.7 and 6.10 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: bartlett-bandwidth->m (b_w &key sampling-time)

given desired smoothing window bandwidth B_W and sampling time, returns
[1] window parameter m required to approximately achieve B_W using the Bartlett lag window
[2] actual B_W achieved

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: bartlett-lag-window (tau m)

given the lag tau and window parameter m, returns the value of the Bartlett lag window —
Note: see Equation (260) of the SAPA book or Priestley, page 439, Equation (6.2.65)

Package

sapa.

Source

nonparametric.lisp.

Function: bartlett-m->bandwidth (m &key sampling-time)

given window parameter m and sampling time,
returns bandwidth B_W for the Bartlett smoothing window —
Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: bartlett-n-m->degrees-of-freedom (n m &key c_h)

given sample size N, window parameter m and variance inflation factor C_h, returns equivalent degrees of freedom nu for Bartlett lag window

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: biased-acvs->unbiased-acvs (biased-acvs)

given a biased estimate of the acvs, returns the corresponding unbiased estimate

Package

sapa.

Source

acvs.lisp.

Function: binary-search (value ordered-seq &key lower-test upper-test)

given
[1] value (required)
==> a real-valued number
[2] ordered-seq (required)
==> an ordered sequence of real-valued numbers
[3] lower-test (keyword; #’<=)
==> a predicate of two arguments
that defines the lower test
[4] upper-test (keyword; #’<=)
==> a predicate of two arguments
that defines the upper test
returns
[1] if lower-test and upper-test are set
to their default values, this function
returns an index i such that v[i] <= value <= v[i+1],
where 0 <= i <= n-2 (if there is no such i, nil is returned); if nondefault values are supplied for lower-test and upper-test, then the condition ‘v[i] <= value <= v[i+1]’
gets modified in an obvious way

Note: value can be an arbitrary object, and ordered-seq
can be a list of arbitrary objects if the binary predicates lower-test and upper-test are appropriate set

Package

sapa.

Source

utilities.lisp.

Function: bisection-with-newton-raphson (f f-prime x-left x-right &key accuracy maximum-number-of-iterations)

given
[1] f (required)
==> a function with a single argument
[2] f-prime (required)
==> another function with a single argument, this one being the first derivative of f [3] x-left (required)
==> left-hand bracket for the desired root; i.e., left-hand bracket <= desired root [4] x-right (required)
==> right-hand bracket for the desired root; i.e., desired root <= right-hand bracket [5] accuracy (keyword; (* 10.0 single-float-epsilon)) ==> desired relative accuracy for computed rood [6] maximum-number-of-iterations (keyword; 100) ==> maximum number of iterations
returns
[1] a root of f in [x-left, x-right];
i.e., a value x in that interval
such that f(x) = 0
[2] the number of iterations required

Note: this function is based loosely on rtsafe, Section 9.4, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: box-plot (a-seq &key seq-sorted-p get-bottom-line get-bottom-of-box get-line-through-box get-top-of-box get-top-line)

given
[1] a-seq (required)
==> a sequence of real-valued numbers
[2] seq-sorted-p (keyword; nil)
==> if t, a-seq is already sorted;
if nil, a copy of a-seq is sorted
for use by the function
[3] get-bottom-line (keyword; computes lower adjacent value) ==> a function for calculating
the line below the box (from sorted data)
[4] get-bottom-of-box (keyword; computes lower quartile) ==> a function for calculating
bottom of the box
[5] get-line-through-box (keyword; computes median)
==> a function for calculating
the line through the middle of the box
[6] get-top-of-box (keyword; computes upper quartile) ==> a function for calculating
top of the box
[7] get-top-line (keyword; computes upper adjacent value) ==> a function for calculating
the line above the box
returns
[1] bottom line below box
[2] bottom line of box
[3] line through middle of box
[4] top line of box
[5] top line above box
[6] a vector containing outside values
(note: this vector can be of length 0)

Note: the values that this function returns can
be used to contruct a box plot as defined in
Section 2.5 of “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner, Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: burg-algorithm (time-series p &key start end center-data ar-coeffs approximate-mses reflection-coeffs forward-prediction-errors backward-prediction-errors exact-mses)

given
[1] time-series (required)
==> a vector containing a real-valued or
complex-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p}
[7] approximate-MSEs (keyword; a vector of length p+1)
<== estimates of innovations variance (mean square errors)
for models of order 0, 1, ..., p (the innovations variance
for the zeroth order model is the sample variance)
[8] reflection-coeffs (keyword; a vector of length p)
<== estimates of reflection coefficients phi_{1,1}, ..., phi_{p,p} [9] forward-prediction-errors (keyword; a vector of length end - start - p) <== computed forward prediction errors
[10] backward-prediction-errors (keyword; a vector of length end - start - p) <== computed backward prediction errors
[11] exact-MSEs (keyword; a vector of length p+1)
<== another set of estimates of innovations variance
for models of order 0, 1, ..., p; these estimates
are based on Equation (419a) of the SAPA book
uses Burg’s algorithm to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t
and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p}
[2] estimate of the innovations variance, i.e.,
the variance of the e_t’s; this number is also given in
(elt approximate-MSEs p)
[3] approximate-MSEs
[4] reflection-coeffs
[5] forward-prediction-errors
[6] backward-prediction-errors
[7] exact-MSEs

Note: see Section 9.5 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: careful-convert-to-db (num &optional zero-mapping)

given
[1] num (required)
==> a number
[1] zero-mapping (required) ==> a number
returns
[1] 10 log_10(num) if num > 0 or zero-mapping if num <= 0

Package

sapa.

Source

utilities.lisp.

Function: center&prewhiten&taper-time-series (time-series &key center-data start end prewhitening-filter recenter-after-prewhitening-p data-taper data-taper-parameters recenter-after-tapering-p restore-power-option-p result)

given
[1] time-series (required)
==> a sequence of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, time-series is not centered
[3] start (keyword; 0)
==> start index of sequence to be used
[4] end (keyword; length of time-series)
==> 1 + end index of sequence to be used
[5] prewhitening-filter (keyword; nil)
==> vector with coeffients of prewhitening filter
or nil (if no prewhitening is to be done)
[6] recenter-after-prewhitening-p (keyword; t)
==> if t, prewhitened series is centered using sample mean (not used if prewhitening-filter is nil)
[7] data-taper (keyword; nil)
==> nil or a tapering function
[8] data-taper-parameters (keyword)
==> parameters for tapering function (not used
if data-taper is nil)
[9] recenter-after-tapering-p (keyword; t)
==> if t and data-taper is a function,
centers tapered series by subtracting
off its sample mean
[10] restore-power-option-p (keyword; t)
==> if t and data-taper is a function,
normalizes tapered series to have same
sum of squares as before tapering
[11] result (keyword; vector of size (- end start))
<== sequence to hold centered, prewhitened
and tapered time series
returns
[1] result, the sequence containing the centered, prewhitened and tapered time series (time-series are unaltered unless it is bound to result)
[2] the number used to center the time series
(this is nil if center-data is nil)
[3] C_h, the variance inflation factor due to the data taper —
Note: see also center&taper-time-series in tapers.lisp

Package

sapa.

Source

filtering.lisp.

Function: center&taper-time-series (time-series &key center-data start end data-taper data-taper-parameters recenter-after-tapering-p restore-power-option-p result)

given
[1] time-series (required)
==> a sequence of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, the effect of this function is to return a copy of the relevant portion of time-series [3] start (keyword; 0)
==> start index of sequence to be used
[4] end (keyword; length of time-series)
==> 1 + end index of sequence to be used
[5] data-taper (keyword; nil)
==> nil or a tapering function
[6] data-taper-parameters (keyword)
==> parameters for tapering function (not used
if data-taper is nil)
[7] recenter-after-tapering-p (keyword; t)
==> if t and data-taper is a function,
centers tapered series by subtracting
off its sample mean
[8] restore-power-option-p (keyword; t)
==> if t and data-taper is a function,
normalizes tapered series to have same
sum of squares as before tapering
[9] result (keyword; vector of size (- end start))
<== sequence to hold centered time series
returns
[1] result, the sequence containing the centered and/or tapered time series (the contents of time-series
are unaltered unless it is also bound to result)
[2] the number used to center the time series
(this is nil if center-data is nil)
[3] C_h, the variance inflation factor due to the data taper —
Note: see also center&prewhiten&taper-time-series
in filtering.lisp

Package

sapa.

Source

tapers.lisp.

Function: cepstrum->i_m (cepstrum &key sampling-time n-prime lag-window-function lambda-factor result)

given
[1] cepstrum (required)
==> a vector of length N_U+1 with values of the cepstrum from lag 0 to N_U
[2] sampling-time (keyword; 1.0)
==> the sample time (i.e., delta t)
[3] N-prime (keyword; 2 * N_U)
==> effective sample size, as discussed in Section 6.15 of the SAPA book (default value ok if N-prime is even, but must be replaced if N-prime is odd)
[4] lag-window-function (keyword; #’parzen-lag-window)
==> lag window function of 2 parameters,
tau (the lag) and m (the window parameter)
[5] lambda-factor (keyword; 1.0)
==> lambda, as discussed in Section 6.15 of the SAPA book [6] result (keyword; vector of same length as cepstrum) <== vector to hold I_m
returns
[1] the value m at which I_m is minimized
[2] result, i.e., I_m for m = 0 to N_U
[3] the minimum value of I_m for m = 0 to N_U

Note: see Equation (283b) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: check-orthonormality (list-of-vectors)

given a list of vectors, computes and prints their sum of squares and pairwise dot products, and returns the maximum absolute deviation from 0
of the pairwise dot products

Package

sapa.

Source

multitaper.lisp.

Function: cholesky! (a b &key eps)

given
[1] A (required)
==> vector of length N*(N+1)/2 representing
a two dimensional N by N positive definite matrix
with elements stored columnwise; i.e, elements with indices 0 1 2 3 4 5 ...
correspond to matrix positions
1,1 1,2 2,2 1,3 2,3 3,3 ...
[2] b (required)
<=> right-hand vector on input;
solution X on output
[3] eps (keyword; single-float-epsilon)
number used to test for a computationally singular matrix solves A X = b using the Cholesky decomposition method, and returns
[1] X, the solution vector (stored in b)

Package

sapa.

Source

matrix.lisp.

Function: circular-shift-sequence (a-seq &key result)

given
[1] a-seq (required)
==> a sequence
[2] result (keyword; vector of same length as a-seq) <== a sequence
returns
[1] a ‘circularly’ left-shifted sequence; i.e., maps x(0), x(1), x(2), ..., x(n-2), x(n-1) to x(n-1), x(0), x(1), ..., x(n-3), x(n-2) —-
Note: result can be the same sequence as result

Package

sapa.

Source

utilities.lisp.

Function: compare-seqs (one-seq another-seq)

given
[1] one-seq (required)
==> any sequence
[2] another-seq (required)
==> any sequence (must be same length as one-seq) returns
[1] maximum absolute difference between corresponding elements of the two sequences
[2] average absolute difference

Note: useful for comparing results that in theory should be identical

Package

sapa.

Source

utilities.lisp.

Function: compose-symmetric-filters (&rest filters)

given any number of symmetric filters (each of odd length and each represented by a vector of coefficients), returns the composite filter
that will produce an output identical to that obtained
by cascading the individual filters

Package

sapa.

Source

filtering.lisp.

Function: convert-from-db (num)

given
[1] num (required) ==> a number returns
[1] 10^(x/10)

Package

sapa.

Source

utilities.lisp.

Function: convert-to-db (num)

given
[1] num (required)
==> a number
returns
[1] 10 log_10(num)

Note: num is intended to be a positive number, but this is not checked

Package

sapa.

Source

utilities.lisp.

Function: copy-vector (from-vector to-vector &key start end)

given
[1] from-vector (required)
==> a vector (actually, works with any sequence) [2] to-vector (required)
==> a vector (actually, works with any sequence) [3] start (keyword; 0)
==> start index of from-vector to be transferred [4] end (keyword; length of from-vector)
==> 1 + end index of from-vector to be transferred returns
[1] to-vector, with elements start to end - 1 from-vector copied into corresponding
elements 0 to end - start - 1 of to-vector

Note: if to-vector is being created on the spot, might consider using CL’s copy-seq instead.

Package

sapa.

Source

utilities.lisp.

Function: cosine-data-taper! (a-time-series &key taper-parameter normalization result)

given
[1] a-time-series (required)
<=> a vector containing a time series;
this vector is modified UNLESS keyword result
is bound to a different vector
[2] taper-parameter (keyword; 1.0, i.e., Hanning data taper) ==> a number >= 0.0 and <= 1.0 that specifies the degree of tapering (parameter p of Equation (209)).
[3] normalization (keyword; :unity)
==> if :unity, taper normalized such that
its sum of squares is equal to unity (Equation (208a)); if :N, taper normalized such that
its sum of squares is equal to the number of points in the time series
[4] result (keyword; a-time-series)
<=> a vector to contain time series multiplied
by cosine data taper
returns
[1] a vector containing the tapered time series
[2] C_h, the variance inflation factor
computed using Equation (251b) in the SAPA book

Package

sapa.

Source

tapers.lisp.

Function: create-ci-for-amt-sdf-estimate (sdf-db dofs &key confidence-level)

given
[1] sdf-dB (required)
==> vector containing an adaptive multitaper spectral estimate expressed in decibels
[2] dofs (required)
==> vector containing the degrees of freedom associated with the values in sdf-dB
[3] confidence-level (keyword; 0.95)
==> the level of the confidence intervals to be created returns
[1] a vector containing the upper confidence interval [2] a vector containing the lower confidence interval —
Note: see Section 7.4 of the SAPA book

Package

sapa.

Source

multitaper.lisp.

Function: create-dpss-low-pass-filter (filter-length delta w &key nyquist-frequency result)

given
[1] filter-length (required)
==> an odd positive integer = 2L +1
[2] delta (required)
==> “W” parameter for dpss in user
units (see page 182 of the SAPA book)
[2] W (required)
==> a cutoff frequency greater than 0
and less than the Nyquist frequency
[3] Nyquist-frequency (keyword; 0.5)
==> the Nyquist frequency
[4] result (keyword; vector of length filter-length)
<== vector of length filter-length
into which filter coefficients
are placed (returned by the function)
uses a dpss as convergence factors in least squares approximation to a low-pass filter and
returns
[1] a symmetric low-pass filter of length 2L+1
and a gain of unity at zero frequency;
i.e., result(0) = result(2L)
result(1) = result(2L-1)
etc., and
(sum result) = 1.0

Note: see Section 5.9 of the SAPA book;
(aref result 0) corresponds to element -L of the filter; (aref result L) corresponds to element 0 of the filter; (aref result (* 2 L)) corresponds to element L of the filter

Package

sapa.

Source

filtering.lisp.

Function: create-least-squares-low-pass-filter (filter-length w &key convergence-factors nyquist-frequency result)

given
[1] filter-length (required)
==> an odd positive integer = 2L +1
[2] W (required)
==> a cutoff frequency greater than 0
and less than the Nyquist frequency
[3] convergence-factors (keyword; nil)
==> a one-argument function that maps
an integer to a convergence factor;
nil is also acceptable, in which case
no convergence factors are used
[4] Nyquist-frequency (keyword; 0.5)
==> the Nyquist frequency
[5] result (keyword; vector of length filter-length)
<== vector of length filter-length
into which filter coefficients
are placed (returned by the function)
uses a least squares approximation to a low-pass filter and returns
[1] a symmetric low-pass filter of length 2L+1
and a gain of unity at zero frequency;
i.e., result(0) = result(2L)
result(1) = result(2L-1)
etc., and
(sum result) = 1.0

Note: see Section 5.8 of the SAPA book;
(aref result 0) corresponds to element -L of the filter; (aref result L) corresponds to element 0 of the filter; (aref result (* 2 L)) corresponds to element L of the filter

Package

sapa.

Source

filtering.lisp.

Function: cumulative-periodogram (time-series &key sampling-time center-data start end cumulative-periodogram-test-p significance-level scratch-dft return-frequencies-p result-freq result)

given
[1] time-series (required)
==> a vector containing time series values
[2] sampling-time (keyword; 1.0)
==> the sample time (i.e., delta t)
[3] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, time-series is not centered
[4] start (keyword; 0)
==> start index of vector to be used
[5] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[6] cumulative-periodogram-test-p (keyword; t)
==> if t, returns values associated with
Kolmogorov test statistic
[7] significance-level (keyword; 0.95)
==> level of significance at which Kolmogorov test
is performed
[8] scratch-dft (keyword; vector of size (- end start))
==> scratch vector used for in-place dft calculations
[9] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the cumulative periodogram are computed and returned in result-freq [10] result-freq (keyword; nil or vector of correct length) <== not used if return-frequencies-p nil; otherwise, vector of correct length into which the frequencies associated with the values in result are placed
[11] result (keyword; vector of correct length)
<== vector to hold normalized cumulative periodogram returns
[1] vector with normalized cumulative periodogram
[2] vector with associated frequencies
and – if cumulative-periodogram-test-p is true –
[3] Kolmogorov test statistic
[4] index of maximum deviation
[5] frequency of maximum deviation
[6] quantile of Kolmogorov test statistic (under null hypothesis) [7] either :reject or :fail-to-reject, depending on whether or not we reject or fail to reject the null hypothesis [8] slope of upper and lower lines
[9] intercept of upper line
[10] intercept of lower line

Note: see Section 6.6 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: cumulative-sums (the-seq &key start end result)

given
[1] the-seq (required)
==> a sequence of numbers
[2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sequence with cumulative sum
of elements in specified subsequence

Package

sapa.

Source

utilities.lisp.

Function: daniell-bandwidth->m (b_w &key sampling-time)

given desired smoothing window bandwidth B_W and sampling time, returns
[1] window parameter m required to approximately achieve B_W using the Daneill lag window
[2] actual B_W achieved (in fact, this is always equal to B_W, but we return it anyway for consistency with other lag windows) —
Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: daniell-lag-window (tau m)

given the lag tau and window parameter m,
returns the value of the Daniell lag window

Note: see equation between Equations (264a) and (264b) of the SAPA book or Priestley, page 441, Equation (6.2.73)

Package

sapa.

Source

nonparametric.lisp.

Function: daniell-m->bandwidth (m &key sampling-time)

given window parameter m and sampling time, returns bandwidth B_W for the Daniell smoothing window —
Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: daniell-n-m->degrees-of-freedom (n m &key c_h)

given sample size N, window parameter m and variance inflation factor C_h, returns equivalent degrees of freedom nu for Daniell lag window

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: dft! (x &key n sampling-time)

given:
[1] x (required)
<=> a vector of real or complex-valued numbers [2] N (keyword; length of x)
==> number of points in dft
[3] sampling-time (keyword; 1.0)
returns:
[1] x, with contents replaced by
the discrete Fourier transform of x, namely, N-1
X(n) = sampling-time SUM x(t) exp(-i 2 pi n t/N) t=0

Note: see Equation (110a) of the SAPA book

Package

sapa.

Source

dft-and-fft.lisp.

Function: dft-chirp! (complex-vector &key n)

given:
[1] complex-vector (required)
<=> a vector of real or complex-valued numbers [2] N (keyword; length of complex-vector)
==> number of points (must be a power of 2) computes the discrete Fourier transform of complex-vector using a chirp transform algorithm and
returns:
[1] complex-vector, with contents replaced by
the discrete Fourier transform of the input, namely, N-1
X(n) = SUM x(t) exp(-i 2 pi n t/N) t=0

Note: see Equation (110a) of the SAPA book
with the sampling time set to unity and
also Section 3.10 for a discussion on
the chirp transform algorithm

Package

sapa.

Source

dft-and-fft.lisp.

Function: difference (sequence-of-numbers &key start end lag result)

given
[1] sequence-of-numbers (required)
==> a sequence of numbers
[2] start (keyword; 0)
==> start index
[3] end (keyword; length of sequence-of-numbers)
==> end index plus one
[4] lag (keyword; 1)
==> lag for differencing
[5] result (keyword; vector of length (- end start lag)) <== results
return
[1] a sequence of length (- end start lag)
with lag-th order difference of sequence
from index start to index end-1

Note: See Newton, 1988, page 31.

Package

sapa.

Source

utilities.lisp.

Function: digamma (x &key x-recursion x-small)

given
[1] x (required)
==> a positive number
[2] x-recursion (keyword; 8.5)
==> for noninteger x,
if x-small < x < x-recursion,
recursive formula is used
[3] x-small (keyword; 1.0e-5)
==> if x <= x-small,
small x approximation used (default )
returns
[1] value of digamma (psi, derivative of log(gamma)) function at x —
Note: see Abramowitz and Stegun’s equation 6.3.2;
expansion 6.3.18 plus recurrence 6.3.5;
the small x formula is Equation (5) from
Algorithm AS 103 – Psi (Digamma) Function – by J. M. Bernardo in Applied Statistics, Vol. 25, No. 3, 1976, pp. 315–317;
note that better accuracy can be obtained by increasing x-recursion — 10.0 to 100.0 are probably useful values

Package

sapa.

Source

basic-math.lisp.

Function: direct-spectral-estimate (time-series &key center-data start end n-nonzero-freqs return-est-for-0-freq-p sampling-time scratch-dft data-taper data-taper-parameters recenter-after-tapering-p restore-power-option-p return-acvs-p result-acvs sdf-transformation result-sdf return-frequencies-p freq-transformation result-freq)

given
[1] time-series (required)
==> a vector of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, time-series is not centered
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[5] N-nonzero-freqs (keyword; :half-next-power-of-2)
==> specifies at how many nonzero frequencies
direct spectral estimate is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [6] return-est-for-0-freq-p (keyword; nil)
==> if t, sdf is computed at zero frequency;
otherwise, it is not computed.
[7] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[8] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[9] data-taper (keyword; nil)
==> nil or a tapering function
[10] data-taper-parameters (keyword)
==> parameters for tapering function (not used
if data-taper is nil)
[11] recenter-after-tapering-p (keyword; t)
==> if t and data-taper is a function,
centers tapered series by subtracting
off its sample mean
[12] restore-power-option-p (keyword; t)
==> if t and data-taper is a function,
normalizes tapered series to have same
sum of squares as before tapering
[13] return-acvs-p (keyword; nil)
==> if t, computes acvs corresponding
to direct spectral estimate
[14] result-acvs (keyword; vector of correct length)
<== vector into which acvs values are placed
(not used if return-acvs-estimate-p is nil)
[15] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[16] result-sdf (keyword; vector of correct length)
<== vector into which direct spectral estimates are placed; it must be exactly of the length dictated
by N-nonzero-freqs and return-est-for-0-freq-p
[17] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral estimate are computed and returned in result-freq
[18] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[19] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of length dictated by
N-nonzero-freqs and return-est-for-0-freq-p
into which the frequencies associated with the values in result-sdf are placed
returns
[1] result-sdf, a vector holding
the properly transformed sdf
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-sdf
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-sdf
[4] C_h, the variance inflation factor due to the data taper [5] result-acvs (if return-acvs-p is t),
a vector holding the acvs corresponding
to the direct spectral estimate
– or –
nil (if return-acvs-p is nil)

Note: see Section 6.3 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: dot-product (x y)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers returns
[1] the dot product of x and y
—-
Note: corresponds to SDOT in LINPACK’s bla

Package

sapa.

Source

utilities.lisp.

Function: dpss-data-taper! (a-time-series &key taper-parameter normalization result)

given
[1] a-time-series (required)
<=> a vector containing a time series;
this vector is modified UNLESS keyword result
is bound to a different vector
[2] taper-parameter (keyword; 4.0)
==> a number > 0.0 that specifies NW,
the product of the sample size and
the half-width of the concentration interval
(see SAPA, page 211)
[3] normalization (keyword; :unity)
==> if :unity, taper normalized such that
its sum of squares is equal to unity (Equation (208a)); if :N, taper normalized such that
its sum of squares is equal to the number of points in the time series
[4] result (keyword; a-time-series)
<=> a vector to contain time series multiplied
by cosine data taper
returns
[1] a vector containing the tapered time series
[2] C_h, the variance inflation factor
computed using Equation (251b) in the SAPA book

Package

sapa.

Source

tapers.lisp.

Function: dpss-tapers-inverse-iteration (n number-of-tapers &key taper-parameter print-progress-p eps)

given
[1] N (required)
the sample size
[2] number-of-tapers (required)
number of orthonormal dpss data tapers
to be computed
[3] taper-parameter (keyword; 4.0)
NW, the duration-half-bandwidth product
(must be such that 0 < NW/N < 1/2)
[4] print-progress-p (keyword; nil)
if t, prints a dot after each eigenvalue
and eigenvector has been computed
[5] eps (keyword; 0.5e-4)
controls accuracy
returns
[1] a list of length number-of-tapers of N dimensional vectors with orthonormal dpss’s of orders 0, 1, ..., number-of-tapers - 1; [2] a vector of length number-of-tapers with the
corresponding eigenvalues

Note: computes the dpss tapers using inverse
iteration (see Section 8.1 of the SAPA book)

Package

sapa.

Source

multitaper.lisp.

Function: dpss-tapers-thomson-approx (n number-of-tapers &key taper-parameter print-progress-p compute-true-eigenvalues-p abscissas weights)

given
[1] N (required)
the sample size
[2] number-of-tapers (required)
number of orthonormal dpss data tapers
to be computed
[3] taper-parameter (keyword; 4.0)
NW, the duration-half-bandwidth product
(must be such that 0 < NW/N < 1/2)
[4] print-progress-p (keyword; nil)
if t, prints a dot after each eigenvalue
and eigenvector has been computed
[5] compute-true-eigenvalues-p (keyword; nil)
if t, returns eigenvalues for eigenproblem
of Equation (378) of the SAPA book;
if nil, returns nil
[6] abscissas (keyword; *abscissas-32-point*)
a vector of abscissas points used
in Gauss-Legendre quadrature
[7] weights (keyword; *abscissas-32-point*)
a vector of weights used
in Gauss-Legendre quadrature
returns
[1] a list of length number-of-tapers of N dimensional vectors with orthonormal dpss’s of orders 0, 1, ..., number-of-tapers - 1; [2] a vector of length number-of-tapers with
eigenvalues if compute-true-eigenvalues-p is t;
nil if if compute-true-eigenvalues-p is nil

Note: computes the dpss tapers using Thomson’s numerical
integration scheme (see Section 8.2 of the SAPA book)

Package

sapa.

Source

multitaper.lisp.

Function: dpss-tapers-tri-diag (n number-of-tapers &key taper-parameter print-progress-p compute-true-eigenvalues-p)

given
[1] N (required)
the sample size
[2] number-of-tapers (required)
number of orthonormal dpss data tapers
to be computed
[3] taper-parameter (keyword; 4.0)
NW, the duration-half-bandwidth product
(must be such that 0 < NW/N < 1/2)
[4] print-progress-p (keyword; nil)
if t, prints a dot after each eigenvalue
and eigenvector has been computed
[5] compute-true-eigenvalues-p (keyword; nil)
if t, returns eigenvalues for eigenproblem
of Equation (378) of the SAPA book;
if nil, returns eigenvalues for tridiagonal
formulation
returns
[1] a list of length number-of-tapers of N dimensional vectors with orthonormal dpss’s of orders 0, 1, ..., number-of-tapers - 1; [2] a vector of length number-of-tapers with
eigenvalues as specified by compute-true-eigenvalues-p

Note: computes the dpss tapers using the tridiagonal
formulation (see Section 8.3 of the SAPA book)

Package

sapa.

Source

multitaper.lisp.

Function: durbin-watson-test-statistic (residuals)

given a set of residuals in a seqeunce, returns the Durbin-Watson test statistic

Package

sapa.

Source

basic-statistics.lisp.

Function: eigenspectra->adaptive-multitaper-spectral-estimate (list-of-eigenspectra eigenvalues variance-of-time-series &key sampling-time n-eigenspectra maximum-number-of-iterations result-dof sdf-transformation result-sdf)

given
[1] list-of-eigenspectra (required)
==> list of eigenspectra (such as optionally returned
by multitaper-spectral-estimate); each eigenspectrum
is assumed to be untransformed (e.g., not expressed
in dB)
[2] eigenvalues (required)
==> vector of eigenvalues corresponding to the dpss’s
used to create the eigenspectra (the length of eigenvalues should be at least as large as the length specified
by N-eigenspectra)
[3] variance-of-time-series (required)
==> variance of time series
from which eigenspectra were computed
[4] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[5] N-eigenspectra (keyword; length of list-of-eigenspectra)
==> number of eigenspectra to be used (must be less than
or equal to the length of list-of-eigenspectra)
[6] maximum-number-of-iterations (keyword; 100)
==> maximum number of iterations
[7] result-dof (keyword; vector of correct length)
<== vector into which degrees of freedom for each value
in the adaptive multitaper spectral estimate is placed;
it must be exactly the same length as each of the vectors
in list-of-eigenspectra
[8] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[9] result-sdf (keyword; vector of correct length)
<== vector into which adaptive multitaper spectral estimate is placed; it must be exactly the same length as each of the vectors
in list-of-eigenspectra
returns
[1] result-sdf, a vector holding
the properly transformed adaptive multitaper spectral estimate
[2] result-dof, a vector holding corresponding degrees of freedom
[3] the maximum number of iterations required to reach convergence
for all of the values in result-sdf

Note: see Section 7.4 of the SAPA book

Package

sapa.

Source

multitaper.lisp.

Function: eigenspectra->multitaper-spectral-estimate (list-of-eigenspectra &key n-eigenspectra sdf-transformation result-sdf)

given
[1] list-of-eigenspectra (required)
==> list of eigenspectra (such as optionally returned
by multitaper-spectral-estimate); each eigenspectrum is assumed to be untransformed (e.g., not expressed in dB) and represented by a vector
[2] N-eigenspectra (keyword; length of list-of-eigenspectra) ==> number of eigenspectra to be used (must be less than or equal to the length of list-of-eigenspectra)
[3] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[4] result-sdf (keyword; vector of correct length)
<== vector into which multitaper spectral estimate is placed; it must be exactly the same length as each of the vectors in list-of-eigenspectra
returns
[1] result-sdf, a vector holding
the properly transformed multitaper spectral estimate

Note: see Section 7.1 of the SAPA book

Package

sapa.

Source

multitaper.lisp.

Function: equivalent-degrees-of-freedom (lag-window-function max-lag &key sampling-time sample-size c_h)

given a lag window function, a maximum lag, the sampling time, the sample size and the variance inflation factor C_h, returns the corresponding equivalent degrees of freedom —
Note: see Equation (255a) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: euclidean-norm (x)

given
[1] x (required)
==> a sequence of numbers returns
[1] Euclidean norm of x
—-
Note: corresponds to LINPACK’s SNRM2, but this is POOR implementation!

Package

sapa.

Source

utilities.lisp.

Function: evaluate-polynomial (polynomial z &key degree-of-polynomial number-of-derivatives complex-values bounds-to-be-computed bounds)

given
[1] polynomial (required)
==> sequence of length n+1 with real or
complex-valued numbers giving the n+1
coefficients of a polynomial of nth order;
(elt polynomial i) = coefficient of z^(n-i)
[2] z (required)
==> complex point at which the polynomial
to be evaluated
[3] degree-of-polynomial (keyword; (1- (length polynomial)))
==> degree of polynomial
[4] number-of-derivatives (keyword; 0)
==> number of derivatives to be evaluated
[5] complex-values (keyword; array of length (1+ number-of-derivatives)) <== sequence with values of polynomial
and derivatives
[6] bounds-to-be-computed (keyword; nil)
==> if t, error bounds are computed
for values in complex-values
[7] bounds (keyword; array of length (1+ number-of-derivatives))
<== sequence with error bounds
returns
[1] the sequence complex-values containing the value
of the polynomial and its derivatives
[2] bounds, a sequence containing optional error bounds

Note: this is a Lisp version of cmlib routine cpevl;
d1 was specified in cpevl as (expt 2 (- 1 (i1mach 11))),
where (i1mach 11) ==> THE NUMBER OF BASE-2 DIGITS (SINGLE PRECISION).
I have taken this to be equivalent to machine epsilon.
If this is in fact NOT the case, then the optional error bounds
might not be computed correctly.

Package

sapa.

Source

basic-math.lisp.

Function: exponential-smoothing (time-series alpha &key initial-prediction return-smoothed-values-p n-predictions result-smoothed result-predictions)

given
[1] time-series (required)
==> a sequence of numbers
[2] alpha (required)
==> parameter controlling the degree of exponential smoothing (usually 0 < alpha < 1)
[3] initial-prediction (keyword; first element of time-series)
==> to get the smoother going, we need a “prediction” for
the first element in the sequence time-series – two
common hacks are the first element itself (the default)
or 0 (if the time series has a zero sample mean)
[4] return-smoothed-values-p (keyword; t)
==> if t, returns smoothed (i.e., filtered) time series
[5] n-predictions (keyword; 0)
==> number of predictions desired
[6] result-smoothed (keyword; vector of length of time-series or nil) <== a sequence to hold smoothed (filtered) time series – used only if return-smoothed-values-p is true
[7] result-predictions (keyword; vector of length n-predictions or nil) <== a sequence to hold predicted values of the time series – used only if n-predictions is positive
returns
[1] sum-of-squares of prediction errors
[2] either one step ahead prediction (if n-predictions is 0)
or vector of length n-predictions if n-predictions > 0)
[3] vector with smoothed values
(nil if return-smoothed-values-p is true)

Note: see Section 7.3 of “Time Series: A Biostatistical Introduction” by Diggle, 1990

Package

sapa.

Source

filtering.lisp.

Function: factorial (k)

given an integer k, returns k!

Package

sapa.

Source

basic-math.lisp.

Function: fast-forward-backward-ls (time-series p &key start end center-data ar-coeffs pseudo-reflection-coeffs)

given
[1] time-series (required)
==> a vector containing a real-valued or complex-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p} [7] pseudo-reflection-coeffs (keyword; a vector of length p) <== sequence of reflection coefficients computed stepwise by the algorithm, but these do not correspond to the estimated phi_{k,p} (even if the estimated AR model is stationary)
uses the forward/backward least squares method
to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p} [2] estimate of the innovations variance, i.e.,
the variance of the e_t’s
[3] pseudo-reflection-coeffs

Note: see Section 9.7 of the SAPA book;
this function is an adaptation of
the Fortran routine modcovar, pp. 258-60,
“Digital Spectral Analysis with Applications”
by Marple, 1987

Package

sapa.

Source

parametric.lisp.

Function: fft! (complex-vector &key n)

given:
[1] complex-vector (required)
<=> a vector of real or complex-valued numbers [2] N (keyword; length of complex-vector)
==> number of points (must be a power of 2) computes the discrete Fourier transform of complex-vector using a fast Fourier transform algorithm and
returns:
[1] complex-vector, with contents replaced by
the discrete Fourier transform of the input, namely, N-1
X(n) = SUM x(t) exp(-i 2 pi n t/N) t=0

Note: see Equation (110a) of the SAPA book
with the sampling time set to unity

Package

sapa.

Source

dft-and-fft.lisp.

Function: filter-time-series (time-series the-filter &key start end technique result)

given
[1] time-series (required)
==> a vector containing a time series
x_0, x_1, ..., x_{N-1}
[2] the-filter (required)
==> a vector containing the filter coefficients g_0, g_1, ..., x_{K-1}
[3] start (keyword; 0)
==> start index of time-series to be used
[4] end (keyword; length of time-series)
==> 1 + end index of time-series to be used
[5] technique (keyword; :fastest)
==> if :fastest, tries to pick fastest method; if :fft, uses fft-based method;
if :direct, uses direct method
[6] result (keyword; vector of appropriate length) <== vector to contain filtered time series K-1
y_t = SUM g_k x_{t+K-1-k}, t = 0, ..., N-K+1 k=0
returns
[1] result, a vector containing the filtered time series [2] the number of values in the filtered time series —
Note: result can be the same as time-series

Package

sapa.

Source

filtering.lisp.

Function: filter-time-series-direct (time-series the-filter &key start end result)

given
[1] time-series (required)
==> a vector containing a time series
x_0, x_1, ..., x_{N-1}
[2] the-filter (required)
==> a vector containing the filter coefficients g_0, g_1, ..., x_{K-1}
[3] start (keyword; 0)
==> start index of time-series to be used
[4] end (keyword; length of time-series)
==> 1 + end index of time-series to be used
[5] result (keyword; vector of appropriate length) <== vector to contain filtered time series K-1
y_t = SUM g_k x_{t+K-1-k}, t = 0, ..., N-K+1 k=0
returns
[1] result, a vector containing the filtered time series [2] the number of values in the filtered time series —
Note: result can be the same as time-series

Package

sapa.

Source

filtering.lisp.

Function: filter-time-series-fft (time-series the-filter &key start end fft-size verbose-p result)

given
[1] time-series (required)
==> a vector containing a time series
x_0, x_1, ..., x_{N-1}
[2] the-filter (required)
==> a vector containing the filter coefficients
g_0, g_1, ..., x_{K-1}
[3] start (keyword; 0)
==> start index of time-series to be used
[4] end (keyword; length of time-series)
==> 1 + end index of time-series to be used
[5] fft-size (keyword; 4 * power of 2 that is ceiling for filter length) ==> size of fft’s to be used (must be a power of 2)
[6] verbose-p (keyword; nil)
==> if t, prints line after each block of data is processed;
if nil, prints nothing
[7] result (keyword; vector of appropriate length)
<== vector to contain filtered time series
K-1
y_t = SUM g_k x_{t+K-1-k}, t = 0, ..., N-K+1 k=0
returns
[1] result, a vector containing the filtered time series
[2] the number of values in the filtered time series

Note: result can be the same as time-series

Package

sapa.

Source

filtering.lisp.

Function: find-peak-of-ar-sdf-using-quadratic-approx (f_1 f_2 f_3 ar-coeffs &key sampling-time db-tolerance)

given
[1] f_1 (required)
==> frequency f_1 such that f_1 < f_2 and S(f_1) < S(f_2),
where S(.) is the sdf associated with AR-coeffs
[2] f_2 (required)
==> middle frequency
[3] f_3 (required)
==> frequency f_3 such that f_3 > f_2 and S(f_3) < S(f_2)
[4] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[5] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[6] dB-tolerance (keyword; 0.1)
==> convergence criterion
returns
[1] estimate of frequency of peak/valley in sdf

Note: for details on this method, see pages 20-21 of Adby and Dempster, “Introduction to Optimization Methods”; note in particular that we search the inverse of the AR portion of the spectrum instead of the spectrum itself in the belief that the quadratic approximation is better with this reformulation

Package

sapa.

Source

parametric.lisp.

Function: find-peak-or-valley-of-sdf-using-bisection+newton-raphson (f-left f-right ersatz-acvs &key sampling-time n accuracy maximum-number-of-iterations)

given
[1] f-left (required)
==> left bracket for frequency of peak/valley
[2] f-right (required)
==> right bracket for frequency of peak/valley
[3] ersatz-acvs (required)
==> vector of length N with acvs (or acs) s_0 to s_{N-1} corresponding to sdf (only elements 1 to N-1 are used) [4] sampling-time (keyword; 1.0)
==> positive number
[5] N (keyword; length of ersatz-acvs)
==> positive integer
[6] accuracy (keyword; 10.0 * single-float-epsilon)
==> passed to bisection-with-Newton-Raphson
[7] maximum-number-of-iterations (keyword; 20)
==> passed to bisection-with-Newton-Raphson
returns
[1] estimate of frequency of peak/valley in sdf
[2] number of iterations required

Note: searches for peak using a combination of
bisection and Newton-Raphson;
see pages 479–80 and 524–5 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: fisher-g-statistic (time-series &key center-data start end alpha)

given
[1] time-series (required)
==> a vector of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, time-series is not centered
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[5] alpha (keyword; 0.05)
==> critical level at which Fisher’s g test
is performed
returns
[1] Fisher’s g statistic
[2] approximation to critical level of Fisher’s g test from Equation (491c)
[3] either :reject or :fail-to-reject, depending on whether or not we reject or fail to reject the null hypothesis of white noise

Note: see Section 10.9 of the SAPA book

Package

sapa.

Source

harmonic.lisp.

Function: forward-backward-ls (time-series p &key start end center-data ar-coeffs)

given
[1] time-series (required)
==> a vector containing a real-valued or complex-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p} uses the forward/backward least squares method
to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p} [2] estimate of the innovations variance, i.e.,
the variance of the e_t’s

Note: see Section 9.7 of the SAPA book;
this function is an adaptation of
the Fortran routine covmcov, pp. 262-4,
“Modern Spectrum Estimation: Theory and Application” by Kay, 1988

Package

sapa.

Source

parametric.lisp.

Function: forward-ls (time-series p &key start end center-data ar-coeffs)

given
[1] time-series (required)
==> a vector containing a real-valued or complex-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p} uses the forward least squares method
to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p} [2] estimate of the innovations variance, i.e.,
the variance of the e_t’s

Note: see Section 9.7 of the SAPA book;
this function is an adaptation of
the Fortran routine covmcov, pp. 262-4,
“Modern Spectrum Estimation: Theory and Application” by Kay, 1988

Package

sapa.

Source

parametric.lisp.

Function: gauss-legendre-quadrature (lower-limit upper-limit n)

given
[1] lower-limit (required)
==> lower limit of integration
[2] upper-limit (required)
==> upper limit of integration
[3] N (required)
==> number of points to be computed
in Gauss-Legendre quadrature returns
[1] an N-dimensional vector of abscissas points [2] an N-dimensional vector of weights

Note: this function is based on gauleg, Section 4.5, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: generate-ar-time-series (coeffs variance sample-size &key process-variance-p list-of-lower-order-phi list-of-lower-order-pev result)

given
[1] coeffs (required)
==> sequence of length p with AR coefficients:
x_t = coeffs_0*x_{t-1} + coeffs_1*x_{t-2}
+ ... + coeffs_{p-1}*x_{t-p} + e_t
(see Equation (392a) in the SAPA book;
the coefficients can be real or complex-valued)
[2] variance (required)
==> process variance or innovations variance
(see keyword process-variance-p)
[3] sample-size (required)
==> length of generated time series
[4] process-variance-p (keyword; t)
==> if t, variance is taken to be process variance
if nil, variance is taken to be innovations variance
[5] list-of-lower-order-phi (keyword; nil)
==> to bypass call to step-down-Levinson-Durbin-recursions (useful for multiple realizations)
[6] list-of-lower-order-pev (keyword; nil)
==> to bypass call to step-down-Levinson-Durbin-recursions
[7] result (keyword; vector of length sample-size)
<== vector with simulated series
generates realization of zero mean normally distributed AR(p) process and returns
[1] result, vector of length sample-size with realization
[2] list-of-lower-order-phi (can be used on subsequent calls
to this function to bypass call to step-down-Levinson-Durbin-recursions)
[3] list-of-lower-order-pev (can be also used on subsequent calls) —
Note: this function generates the proper stationary initial conditions

Package

sapa.

Source

random.lisp.

Function: generate-backward-innovations (time-series ar-coeffs &key start end center-data result)

given
[1] time-series (required)
==> a vector containing a real-valued
time series x_t
[2] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p} for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2} + ... + phi_{p,p} * x_{t-p} + e_t
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series (the vector time-series is not altered)
[6] result (keyword; vector of appropriate length)
<== vector to contain backward innovations p
b_t = x_t - SUM phi_{j,p} x_{t+j}, t = 1, ..., N-p j=1
returns
[1] result, i.e., the backward innovations

Package

sapa.

Source

parametric.lisp.

Function: generate-forward-innovations (time-series ar-coeffs &key start end center-data result)

given
[1] time-series (required)
==> a vector containing a real-valued
time series x_t
[2] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series (the vector time-series is not altered)
[6] result (keyword; vector of appropriate length)
<== vector to contain forward innovations p
f_t = x_{t+p} - SUM phi_{j,p} x_{t-j}, t = 1, ..., N - p j=1
returns
[1] result, i.e., the fprward innovations

Package

sapa.

Source

parametric.lisp.

Function: generate-ma-time-series (coeffs variance sample-size &key process-variance-p result)

given
[1] coeffs (required)
==> sequence of length q with MA coefficients:
x_t = e_t - coeffs_0*e_{t-1}
- coeffs_1*e_{t-2}
- ... - coeffs_{q-1}*e_{t-q}
(see Equation (43a) in the SAPA book)
[2] variance (required)
==> process variance or innovations variance
(see keyword process-variance-p)
[3] sample-size (required)
==> length of generated time series
[4] process-variance-p (keyword; t)
==> if t, variance is taken to be process variance
if nil, variance is taken to be innovations variance
[5] result (keyword; vector of length sample-size)
<== vector with simulated series
generates realization of zero mean normally distributed MA(q) process and returns
[1] vector of length sample-size with realization

Package

sapa.

Source

random.lisp.

Function: generate-white-noise (n &key distribution result)

given
[1] n (required)
==> a sample size
[2] distribution (keyword; :normal)
==> either a keyword or a function with no arguments that returns a random deviate from a particular distribution. Choices are
:binary :cauchy :chi-square-2 :double-exponential :exponential
:extreme-value :Gaussian (same as :normal) :logistic :lognormal :normal :uniform
[3] result (keyword; vector of length n)
<== a sequence in which results are to be stored return
[1] result, containing n samples from a white noise process with a distribution specified by the keyword distribution

Package

sapa.

Source

random.lisp.

Function: grenander-smoothing-window-bandwidth (lag-window-function max-lag &key sampling-time)

given a lag window function, a maximum lag and the sampling time, returns Grenander’s measure of smoothing window bandwidth

Note: see Equations (241c) and (241b) of the SAPA book; unfortunately, because of the square root operation, this measure can be complex-valued for certain lag windows

Package

sapa.

Source

nonparametric.lisp.

Function: hanning-data-taper! (a-time-series &key taper-parameter normalization result)

calls cosine-data-taper! with taper-parameter set to 1.0

Package

sapa.

Source

tapers.lisp.

Function: hermitian-transpose (a-matrix &key result)

given
[1] A (required)
==> a 2d matrix
[2] result (keyword; new 2d array of appropriate size)
<== a 2d matrix to contain Hermitian transpose of a-matrix returns
[1] Hermitian transpose of a-matrix (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: histogram (sequence-of-deviates &key number-of-bins left-of-first-bin right-of-last-bin scale-as-density-p result)

given
[1] sequence-of-deviates (required)
==> a sequence of real-valued numbers
[2] number-of-bins (keyword; 10)
==> number of bins in histogram
[3] left-of-first-bin (keyword; min of sequence-of-deviates)
==> leftmost value of first bin
[4] right-of-last-bin (keyword; max of sequence-of-deviates)
==> rightmost value of last bin
[5] scale-as-density-p (keyword; t)
==> if t, histogram is scaled as a density;
otherwise, cell counts are returned
[6] result (keyword; vector of size number-of-bins)
<== vector to hold the histogram
returns
[1] the vector result, which contains the values for the histogram for sequence-of-deviates (one value for each bin); note that,
if a bin has boundaries a and b, all points x in sequence-of-deviates for which a<=x<b are counted as being in that bin
EXCEPT for the last bin, where the rule is a<=x<=b.
[2] maximum value in the histogram (i.e., result)
[3] leftmost value of first bin
[4] bin-width of bins
[5] the number of unbinned elements in sequence-of-deviates
less than left-of-first-bin
[6] the number of unbinned elements in sequence-of-deviates
greater than right-of-last-bin

Note: the value in (svref result 0) is the histogram value
for the interval [leftmost value of first bin,
leftmost value of first bin + bin-width of bins); the value in (svref result 1) is the histogram value
for the interval [leftmost value of first bin + bin-width of bins, leftmost value of first bin + 2*bin-width of bins); etc.

Package

sapa.

Source

basic-statistics.lisp.

Function: huber-weight-function (x &key parameter)

given
[1] x (required)
==> value at which to evaluate Huber’s weight function [2] parameter (keyword; 1.5)
==> tuning parameter
returns
[1] value of Huber’s weight function at x

Package

sapa.

Source

basic-statistics.lisp.

Function: ideal-band-pass-filter-irs (k w-low w-high)

given
[1] k (required)
==> index of member of impulse response sequence (irs) to be calculated (must be an integer)
[2] W-low (required)
==> the low frequency cutoff (in standardized units) [3] W-high (required)
==> the high frequency cutoff (in standardized units so that 0 <= W-low < W-high <= 0.5, the assumed Nyquist frequency).
returns
[1] k-th member of the impulse response sequence
for an ideal band-pass filter

Package

sapa.

Source

filtering.lisp.

Function: ideal-high-pass-filter-irs (k w)

given
[1] k (required)
==> index of member of impulse response sequence (irs) to be calculated (must be an integer)
[2] W (required)
==> the cutoff frequency, standardized such that
0 < W < 0.5 = Nyquist frequency
returns
[1] kth member of the impulse response sequence
for an ideal low-pass filter with cutoff frequency W

Package

sapa.

Source

filtering.lisp.

Function: ideal-low-pass-filter-irs (k w)

given
[1] k (required)
==> index of member of impulse response sequence (irs) to be calculated (must be an integer)
[2] W (required)
==> the cutoff frequency, standardized such that
0 < W < 0.5 = Nyquist frequency
returns
[1] kth member of the impulse response sequence
for an ideal low-pass filter with cutoff frequency W —
Note: see Section 5.8 of the SAPA book

Package

sapa.

Source

filtering.lisp.

Function: integrate-sdf (sdf freqs &key fiddle-factor return-integrated-sdf-p result)

given
[1] sdf (required)
==> vector with sdf for a real or complex-valued process computed over a grid of frequencies (the grid
need not be uniform) – note that the sdf values
must be untransformed (e.g., not in decibels)
[2] freqs (required)
==> vector with frequencies over which
sdf has been computed
(must be same size as vector with sdf values)
[3] fiddle-factor (keyword; 2.0)
==> values returned are all multiplied by this factor;
the default of 2 is useful for real-valued processes since these have symmetric two-sided sdf’s.
[4] return-integrated-sdf-p (keyword; nil)
==> if t, integrated sdf as a function of frequency
is computed and returned in result
[5] result (keyword; vector of length sdf)
<== vector with integrated sdf (if return-integrated-sdf-p is t) or nil (if return-integrated-sdf-p is nil)
returns
[1] the integral of the sdf * fiddle-factor
[2] result, i.e., the integrated sdf
if return-integrated-sdf-p is t

Package

sapa.

Source

parametric.lisp.

Function: interquartile-range (the-seq &key start end the-seq-is-ordered-p)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used [4] the-seq-is-ordered-p (keyword; nil) ==> if t, the-seq is assumed to
be sorted from smallest to largest value; if nil, the-seq will be sorted returns
[1] interquartile range; i.e,
0.75 quantile minus 0.25 quantile

Package

sapa.

Source

basic-statistics.lisp.

Function: inverse-dft! (x &key n sampling-time)

given:
[1] X (required)
<=> a vector of real or complex-valued numbers
[2] N (keyword; length of )
==> number of points in inverse dft
[3] sampling-time (keyword; 1.0)
returns:
[1] X, with contents replaced by
the inverse discrete Fourier transform of X, namely, N-1
x(t) = (N sampling-time)^{-1} SUM X(n) exp(i 2 pi n t/N) n=0

Note: see Equation (111a) of the SAPA book

Package

sapa.

Source

dft-and-fft.lisp.

Function: inverse-fft! (complex-vector &key n)

given:
[1] complex-vector (required)
<=> a vector of real or complex-valued numbers
[2] N (keyword; length of )
==> number of points in inverse dft
(must be a power of 2)
computes the inverse discrete Fourier transform of complex-vector using a fast Fourier transform algorithm and
returns:
[1] complex-vector, with contents replaced by
the inverse discrete Fourier transform of
the input X(n), namely,
N-1
x(t) = 1/N SUM X(n) exp(i 2 pi n t/N) n=0

Note: see Equation (111a) of the SAPA book
with the sampling time set to unity

Package

sapa.

Source

dft-and-fft.lisp.

Function: iota (start end &key type float-p skip result)

given
[1] start (required)
==> an integer
[2] end (required)
==> an integer >= start
[3] type (keyword; ’vector)
==> type of sequence desired
[4] float-p (keyword; nil)
==> if true, sequence consists of floats
[5] skip (keyword; 1)
==> desired increment between integers in sequence [6] result (keyword; sequence of length (1+ (- start end))) ==> storage space for result
returns
[1] a sequence of length (1+ (/ (- end start) skip)) with numbers start, start + skip, ..., end - skip, end (these are stored in whatever result points to)

Package

sapa.

Source

utilities.lisp.

Function: jenkins-smoothing-window-bandwidth (lag-window-function max-lag &key sampling-time)

given a lag window function, a maximum lag and the sampling time, returns Jenkins’ measure of smoothing window bandwidth

Note: see Equation (242c) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: kernel-pdf-estimation (a-seq start-x increment-x n-pdf &key window-width result-pdf result-x)

given
[1] a-seq (required)
==> a sequence of real-valued numbers
[2] start-x (required)
==> first point at which pdf is
to be estimated
[3] increment-x (required)
==> increment between points at which pdf is
to be estimated (i.e., second point is
at start-x + increment-x, third point is
at start-x + 2*increment-x, etc)
[4] n-pdf (required)
==> number of points at which pdf is
to be estimated
[5] window-width (keyword; Silverman’s formula)
==> window width of kernel pdf estimator
[6] result-pdf (keyword; vector of length n-pdf)
<== vector to hold pdf estimate
[7] result-x (keyword; vector of length n-pdf)
<== vector to hold points at which
pdf was estimated
computes a pdf estimate using the normal (Gaussian) kernel and returns
[1] the pdf estimate (in result-pdf)
[2] the points associated with the pdf estimates (in result-x) [3] the window width

Package

sapa.

Source

basic-statistics.lisp.

Function: lag-window-spectral-estimate (acvs lag-window-function &key max-lag n-ts n-nonzero-freqs return-est-for-0-freq-p sampling-time scratch-dft c_h sdf-transformation result-sdf return-frequencies-p freq-transformation result-freq)

given
[1] acvs (required)
==> vector containing autocovariance sequence
[2] lag-window-function (required)
==> function of a single variable that computes the value of the lag window for a given lag
[3] max-lag (keyword; (1- (length acvs)))
==> maximum lag in acvs to be used
[4] N-ts (keyword; length of acvs)
==> length of the time series from which acvs was constructed; this is needed to compute equivalent degrees of freedom [5] N-nonzero-freqs (keyword; :half-next-power-of-2)
==> specifies at how many nonzero frequencies
direct spectral estimate is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [6] return-est-for-0-freq-p (keyword; nil)
==> if t, sdf is computed at zero frequency;
otherwise, it is not computed.
[7] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[8] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[9] C_h (keyword; 1.0)
==> variance inflation factor due to tapering
[10] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[11] result-sdf (keyword; vector of correct length)
<== vector into which lag window spectral estimates are placed; it must be exactly of the length dictated
by N-nonzero-freqs and return-est-for-0-freq-p
[12] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral estimate are computed and returned in result-freq
[13] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[14] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of length dictated by
N-nonzero-freqs and return-est-for-0-freq-p
into which the frequencies associated with the values in result-sdf are placed
returns
[1] result-sdf, a vector holding
the properly transformed sdf
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-sdf
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-sdf
[4] the equivalent degrees of freedom
[5] the smoothing window bandwidth

Note: see Section 6.7 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: linear-interpolation! (a-sequence &key interpolation-predicate)

given
[1] a-sequence (required)
<=> a sequence of numbers
[2] interpolation-predicate (keyword; #’zerop) ==> a unitary predicate which, when true, indicates that a value in a-sequence
is to be replaced by a linear interpolation returns
[1] a-sequence, modified with linear interpolates over specified values

Package

sapa.

Source

utilities.lisp.

Function: linearized-upper-trangular->2d-matrix (a &key result)

given
[1] A (required)
==> a vector with an upper triangular matrix stored in linearized form
[2] result (keyword; new 2d array of appropriate size) <== a 2d hermitian matrix filled according
to contents of A
converts linearized form A into 2d hermitian array and returns
[1] result, a 2d hermitian matrix

Package

sapa.

Source

matrix.lisp.

Function: log-of-gamma (xx)

given xx (a real or complex valued number whose real part is greater than 0),
returns the log (base e) of gamma(xx)

Note: based upon the discussion in Section 6.1, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: log10 (num)

given
[1] num (required)
==> a number
returns
[1] log_10(num)

Note: shorthand for (log num 10)

Package

sapa.

Source

utilities.lisp.

Function: lower-triangular-solve! (a b &key n)

given
[1] A (required)
==> lower n by n triangular matrix
(note: upper superdiagonal part of this matrix is ignored) [2] b (required)
<=> on input, the right-hand side vector;
on output, the solution X to A X = b
[3] n (keyword; length of b)
==> order of matrix A
returns
[4] X, the solution to A X = b, where X is the same as vector which contained b (note that A is left unchanged)

Package

sapa.

Source

matrix.lisp.

Function: m-location-estimate (the-seq &key weighting-functions iterations)

given
[1] the-seq (required)
==> a sequence of numbers
[2] weighting-functions (keyword; Huber and Thomson) ==> a list of two weighting functions
[3] iterations (keyword; ’(10 0))
==> a list of nonegative integers
giving the number of iterations
for each weighting function
returns
[1] m-location estimate for sequence
[2] MAD scale estimate (based upon deviations from m-location estimate)

Note: see article by Hogg in Launer and Wilkinson

Package

sapa.

Source

basic-statistics.lisp.

Function: max-of-seq (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] maximum value in sequence
[2] index of maximum value

Package

sapa.

Source

utilities.lisp.

Function: median-absolute-deviation (the-seq &key location-estimate)

given
[1] the-seq (required)
==> a sequence of real-valued numbers
[2] location-estimate (keyword; median of the-seq) ==> robust estimate of location
returns
[1] the median absolute deviation about location-estimate [2] location-estimate (median of the-seq by default)

Package

sapa.

Source

basic-statistics.lisp.

Function: min-and-max-of-seq (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] minimum value in sequence
[2] maximum value in sequence

Package

sapa.

Source

utilities.lisp.

Function: min-of-seq (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] minimum value in sequence
[2] index of minimum value

Package

sapa.

Source

utilities.lisp.

Function: modified-gram-schmidt! (a-matrix)

given
[1] A (required)
<=> a matrix of real or complex-valued numbers with size m by n with rank N
computes the factorization A = QR, where
Q is of size m by n and has orthonormal columns and R is of size n by n and is upper triangular, and returns
[1] Q
[2] R

Note: see Algorithm 5.2.5, p. 219, of Golub and Van Loan, Second Edition, with simple changes to handle matrices with real or complex-valued numbers

Package

sapa.

Source

matrix.lisp.

Function: multiply-2-polynomials (polynomial-1 polynomial-2 &key degree-of-1 degree-of-2 product-polynomial)

given
[1] polynomial-1 (required)
==> sequence of length n+1 with real or
complex-valued numbers giving the n+1
coefficients of a polynomial of nth order;
(elt polynomial-1 i) = coefficient of z^(n-i)
[2] polynomial-2 (required)
==> another sequence representing another polynomial
[3] degree-of-1 (keyword; (1- (length polynomial-1)))
==> degree of first polynomial
[4] degree-of-2 (keyword; (1- (length polynomial-2)))
==> degree of second polynomial
[5] product-polynomial (keyword; array of length (+ degree-of-1 degree-of-2 1)) <== a sequence with product of two polynomials
returns
[1] product-polynomial, an sequence with coefficients
of polynomial given by the product of
polynomial-1 and polynomial-2

Note: this routine works for a polynomial p represented either by
p(0) + p(1)*z + ... + p(degp)*z^degp
or by
p(0)*z**degp + p(1)*z**(degp-1) + ... + p(degp)

Package

sapa.

Source

basic-math.lisp.

Function: multiply-matrix-and-scalar (a-matrix scalar &key result)

given
[1] a-matrix (required)
==> a 2d matrix
[2] scalar (required)
==> an arbitrary number
[3] result (keyword; new matrix of same size as a-matrix) <== a matrix to contain product of a-matrix and scalar returns
[1] product of a-matrix and scalar (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: multiply-matrix-and-vector (a-matrix b-vector &key result)

given
[1] a-matrix (required)
==> a 2d matrix
[2] b-vector (required)
==> a vector, with dimensions such that
the product of a-matrix and b-vector is defined [3] result (keyword; new vector of appropriate size)
<== a vector to contain product of a-matrix and b-vector returns
[1] product of a-matrix and b-vector (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: multiply-polynomials (&rest polys)

given
[1] sequences representing any number of polynomials (required) returns
[1] a sequence representing their product

Note: this function was written by Andrew G. Bruce

Package

sapa.

Source

basic-math.lisp.

Function: multiply-sequences (&rest seqs)

given
[1] a arbitrary number of sequences of numbers, all of the same size
returns
[1] a new sequence formed by multiplying the sequences together on an element by element basis

Package

sapa.

Source

utilities.lisp.

Function: multiply-two-matrices (a-matrix b-matrix &key result)

given
[1] a-matrix (required)
==> a 2d matrix
[2] b-matrix (required)
==> another 2d matrix, with dimensions such that the product of a-matrix and b-matrix is defined [3] result (keyword; new 2d array of appropriate size) <== a 2d matrix to contain product of two matrices returns
[1] product of two matrices (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: multitaper-spectral-estimate (time-series list-of-data-tapers &key center-data start end n-tapers n-nonzero-freqs return-est-for-0-freq-p sampling-time scratch-dft recenter-after-tapering-p restore-power-option-p sdf-transformation result-sdf return-eigenpspectra-p return-frequencies-p freq-transformation result-freq)

given
[1] time-series (required)
==> a sequence of time series values
[2] list-of-data-tapers (required)
==> a list of orthonormal data tapers,
each of length (- end start)
[3] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, time-series is not centered
[4] start (keyword; 0)
==> start index of sequence to be used
[5] end (keyword; length of time-series)
==> 1 + end index of sequence to be used
[6] N-tapers (keyword; length of list-of-data-tapers)
==> number of data tapers to be used in list-of-data-tapers
[7] N-nonzero-freqs (keyword; :half-next-power-of-2)
==> specifies at how many nonzero frequencies
multitaper spectral estimate is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size;
:Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size]
[8] return-est-for-0-freq-p (keyword; nil)
==> if t, sdf is computed at zero frequency;
otherwise, it is not computed.
[9] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[10] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[11] recenter-after-tapering-p (keyword; t)
==> if t and data-taper is a function,
centers tapered series by subtracting
off its sample mean
[12] restore-power-option-p (keyword; t)
==> if t and data-taper is a function,
normalizes tapered series to have same
sum of squares as before tapering
[13] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[14] result-sdf (keyword; vector of correct length)
<== vector into which multitaper spectral estimate is placed;
it must be exactly of the length dictated
by N-nonzero-freqs and return-est-for-0-freq-p
[15] return-eigenpspectra-p (keyword; t)
==> if t, individual eigenspectra are returned in a list
(each eigenspectrum in the list is associated with
the corresponding taper in list-of-data-tapers)
[16] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral estimate
are computed and returned in result-freq
[17] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[18] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of length N-nonzero-freqs (if return-est-for-0-freq-p is nil) or N-nonzero-freqs +1 (if return-est-for-0-freq-p is t)
into which the frequencies associated with the values
in result-sdf are placed
returns
[1] result-sdf, a vector holding
the properly transformed multitaper spectral estimate
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-sdf,
or
nil (if return-frequencies-p is nil)
[3] the length of the vector result-sdf
[4] a list of untransformed eigenspectra (return-eigenpspectra-p is t), or
nil (if return-eigenpspectra-p is nil)

Note: see Section 7.1 of the SAPA book

Package

sapa.

Source

multitaper.lisp.

Function: n-applications-of-three-point-smoother (a-seq n)

given
[1] a-seq (required)
==> a sequence of length 2*n + 1 or greater [2] n (required)
==> positive integer indicating the number of times the three-point smoother is to be applied
returns
[1] the result of repetitively smoothing a-seq using the function three-point-smoother

Package

sapa.

Source

filtering.lisp.

Function: newton-raphson (f f-prime x-left x-right &key accuracy maximum-number-of-iterations prevent-bracket-jumping-p)

given
[1] f (required)
==> a function with a single argument
[2] f-prime (required)
==> another function with a single argument, this one being the first derivative of f [3] x-left (required)
==> left-hand bracket for the desired root; i.e., left-hand bracket <= desired root [4] x-right (required)
==> right-hand bracket for the desired root; i.e., desired root <= right-hand bracket [5] accuracy (keyword; (* 10.0 single-float-epsilon)) ==> desired relative accuracy for computed rood [6] maximum-number-of-iterations (keyword; 20) ==> maximum number of iterations
[7] prevent-bracket-jumping-p (keyword; t)
==> if t, allows Newton-Raphson to continue if it jumps out of the interval
[x-left, x-right];
if nil, jumping out of the interval causes an error to be signaled
returns
[1] a root of f in [x-left, x-right];
i.e., a value x in that interval
such that f(x) = 0
[2] the number of iterations required

Note: this function is based loosely on rtnewt, Section 9.4, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: next-power-of-2 (n)

given
[1] n (required)
==> an integer
returns
[1] an integer power of 2 greater than or equal to n

Package

sapa.

Source

utilities.lisp.

Function: nyquist-frequency->sampling-time (nyquist-frequency)

given a Nyquist frequency, returns the associated sampling-time —
Note: see page 98 of the SAPA book

Package

sapa.

Source

utilities.lisp.

Function: one-sided-freq->two-sided-freq (one-sided-freq &key result)

given a vector of N frequencies
0, f_1, ..., f_{N-1},
returns the vector of 2N-1 frequencies -f_{N-1}, ..., -f_1, 0, f_1, ..., f_{N-1}

Package

sapa.

Source

nonparametric.lisp.

Function: one-sided-sdf->two-sided-sdf (one-sided-sdf &key result)

given a one-sided sdf
S(0), S(f_1), ..., S_(f_{N-1}) of length N,
returns the two-sized sdf
S_(-f_{N-1}), ..., S(-f_1), S(0), S(f_1), ..., S_(f_{N-1}) of length 2N-1, where S_(-f_k) = S_(f_k)

Package

sapa.

Source

nonparametric.lisp.

Function: ordinary-least-squares-cholesky (dependent-variable list-of-independent-variables &key compute-residuals-p result)

given
[1] dependent-variable (required)
==> a vector
[2] list-of-independent-variables (required)
==> a list of either vectors or functions
(must be ALL vectors or ALL functions)
[3] compute-residuals-p (keyword; nil)
==> if t, residuals are computed
[4] result (keyword; new array if compute-residuals-p is t; otherwise nil) <== storage space for residuals
(not used unless compute-residuals-p is true)
returns
[1] vector with estimated parameters
[2] residuals

Note: uses Lisp versions of Cholesky factorization routines
from linpack

Package

sapa.

Source

basic-statistics.lisp.

Function: ordinary-least-squares-q-r (dependent-variable list-of-independent-variables &key compute-residuals-p compute-standard-errors-p compute-correlation-matrix-p residuals)

given
[1] dependent-variable (required)
==> a vector
[2] list-of-independent-variables (required)
==> a list of either vectors, functions or mixture thereof [3] compute-residuals-p (keyword; nil)
==> if t, residuals are computed
[4] compute-standard-errors-p (keyword; nil)
==> if t, standard errors for parameter estimates are computed, along with residuals (even if compute-residuals-p is nil) [5] compute-correlation-matrix-p (keyword; nil)
==> if t, correlation matrix for parameter estimates is computed, along with residuals and standard errors (even if either of their associated keywords is nil)
[6] residuals (keyword; nil or vector)
<== storage space for residuals
(nil unless either compute-residuals-p, compute-standard-errors-p or
compute-correlation-matrix-p is true)
returns
[1] vector with parameter estimates
[2] vector with residuals
[2] standard error of residuals
[3] vector with standard errors of parameter estimates
[4] correlation matrix

Note: this routine is based on the discussion
in “Nonlinear Regression Analysis and Its Applications”
by Bates and Watts, Wiley, 1988.

Package

sapa.

Source

basic-statistics.lisp.

Function: papoulis-bandwidth->m (b_w &key sampling-time)

given desired smoothing window bandwidth B_W and sampling time, returns
[1] window parameter m required to approximately achieve B_W using the Papoulis lag window
[2] actual B_W achieved

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: papoulis-lag-window (tau m)

given the lag tau and window parameter m,
returns the value of the Papoulis lag window

Note: see equation near bottom of page 266 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: papoulis-m->bandwidth (m &key sampling-time)

given window parameter m and sampling time,
returns bandwidth B_W for the Papoulis smoothing window —
Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: papoulis-n-m->degrees-of-freedom (n m &key c_h)

given sample size N, window parameter m and variance inflation factor C_h, returns equivalent degrees of freedom nu for Papoulis lag window

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: parzen-bandwidth->m (b_w &key sampling-time)

given desired smoothing window bandwidth B_W and sampling time, returns
[1] window parameter m required to approximately achieve B_W using the Parzen lag window
[2] actual B_W achieved

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: parzen-lag-window (tau m)

given the lag tau and window parameter m, returns the value of the Parzen lag window

Note: see the equation on page 265 of the SAPA book or Priestley, page 443, Equation (6.2.82)

Package

sapa.

Source

nonparametric.lisp.

Function: parzen-m->bandwidth (m &key sampling-time)

given window parameter m and sampling time, returns bandwidth B_W for the Parzen smoothing window —
Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: parzen-n-m->degrees-of-freedom (n m &key c_h)

given sample size N, window parameter m and variance inflation factor C_h, returns equivalent degrees of freedom nu for Parzen lag window

Note: see Table 269 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: periodogram (time-series &key center-data start end n-nonzero-freqs return-est-for-0-freq-p sampling-time scratch-dft sdf-transformation result-sdf return-frequencies-p freq-transformation result-freq)

given
[1] time-series (required)
==> a vector of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, time-series is not centered
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[5] N-nonzero-freqs (keyword; :half-next-power-of-2)
==> specifies at how many nonzero frequencies periodogram is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [6] return-est-for-0-freq-p (keyword; nil)
==> if t, periodogram is computed at zero frequency; otherwise, it is not computed.
[7] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book) [8] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[9] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[10] result-sdf (keyword; vector of correct length)
<== vector into which periodogram is placed;
it must be exactly of the length dictated
by N-nonzero-freqs and return-est-for-0-freq-p [11] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the periodogram are computed and returned in result-freq
[12] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true) [13] result-freq (keyword; nil or vector of correct length) <== not used if return-frequencies-p nil; otherwise, vector of length dictated by
N-nonzero-freqs and return-est-for-0-freq-p
into which the frequencies associated with the values in result-sdf are placed
returns
[1] result-sdf, a vector holding
the properly transformed periodogram
[2] result-freq (if return-frequencies-p is t),
a vector holding the properly transformed
frequencies associated with values in result-sdf
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-sdf

Note: see Section 6.3 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: periodogram-at-one-frequency (time-series freq &key center-data start end sampling-time)

given
[1] time-series (required)
==> a vector of time series values
[2] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series; if nil, time-series is not centered
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[5] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book) returns
[1] value of periodogram at freq
[2] approximate conditional least squares estimate for A, the amplitude of cosine term in Equation (461a)
of the SAPA book
[3] approximate conditional least squares estimate for B the amplitude of sine term

Note: see Section 10.2 of the SAPA book

Package

sapa.

Source

harmonic.lisp.

Function: postcolor-spectral-estimate (precolored-sdf-estimate prewhitening-filter sample-size &key n-nonzero-freqs includes-est-for-0-freq-p scratch-dft sdf-transformation result-sdf)

given
[1] precolored-sdf-estimate (required)
==> vector containing sdf estimate to be postcolored;
note that this estimate is assumed to be untransformed (i.e., not expressed in dB, etc)
[2] prewhitening-filter (required)
==> vector with coefficients of prewhitening filter
[3] sample-size (required)
==> length of the time series from which precolored-sdf-estimate was constructed; this is needed to get corresponding
grid of frequencies
[4] N-nonzero-freqs (keyword; :half-next-power-of-2)
==> specifies at how many nonzero frequencies precolored-sdf-estimate was computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size;
:Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size]
[5] includes-est-for-0-freq-p (keyword; nil)
==> if t, first element of precolored-sdf-estimate corresponds to zero frequency
[6] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[7] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[8] result-sdf (keyword; vector of correct length)
<== vector into which postcolored sdf estimate is placed;
it must be exactly the same length as precolored-sdf-estimate returns
[1] result-sdf, a vector holding
the postcolored sdf estimate

Note: see Equation (438) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: power-of-2 (n)

given
[1] n (required)
==> an integer
returns
[1] nil if n is not a power of 2
– or –
m if n = 2^m for a positive integer m

Package

sapa.

Source

utilities.lisp.

Function: predicted-y-at-x (x intercept slope)

given
[1] x (required)
==> a number
[2] intercept (required) ==> intercept of a line [3] slope (required) ==> slope of a line returns
[1] intercept + slope*x

Package

sapa.

Source

basic-statistics.lisp.

Function: print-1-or-2-d-array (an-array &key tag format-control-for-array-element)

given
[1] an-array (required)
==> a one-dimensional or two-dimensional array [2] tag (keyword; ‘array’)
==> an optional tag to be printed
along with array elements
[3] format-control-for-array-element (keyword; ‘~F’) ==> format control for a single array element prints the elements of an-array and
returns
[1] an-array

Package

sapa.

Source

matrix.lisp.

Function: print-rows-of-nxm-matrix (an-nxm-matrix &key format-control-for-array-element)

given
[1] an-nxm-matrix (required)
==> a two-dimensional array
[3] format-control-for-array-element (keyword; ‘~F’) ==> format control for a single array element prints the elements of the 2d array and
returns
[1] an-nxm-matrix

Package

sapa.

Source

matrix.lisp.

Function: q-q-plot (y-vals x-vals &key n x-vals-sorted-p y-vals-sorted-p)

given
[1] y-vals (required)
==> a sequence or function
[2] x-vals (required)
==> a sequence or function
[3] n (keyword; 256 if y-vals is a function, length of y-vals otherwise) ==> positive integer
[4] x-vals-sorted-p (keyword; t if x-vals is a function, nil otherwise) ==> a flag indicating whether x-vals is already sorted
[5] y-vals-sorted-p (keyword; t if y-vals is a function, nil otherwise) ==> a flag indicating whether y-vals is already sorted
return
[1] y values needed to create a q-q-plot for y-vals
[2] x values

Note: For details, see Chapter 6 of “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner and Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: q-r! (a-matrix)

same as modified-Gram-Schmidt!

Package

sapa.

Source

matrix.lisp.

Function: quantile-of-chi-square-2-distribution (p)

given
[1] p (required)
==> a number > 0 and < 1
returns
[1] p-th quantile of chi-square distribution with 2 degrees of freedom —
Note: Equation (31), P. 640 of Chave, Thomson, and Ander (1987)

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-of-chi-square-distribution (nu p &key accuracy-level)

given
[1] nu (required)
==> degrees of freedom
[2] p (required)
==> a number > 0 and < 1
[3] accuracy-level (keyword; :quick)
if :quick, gives quick approximation;
if :accurate, give accurate, but computationally
expensive, approximation
returns
[1] p-th quantile of chi-square distribution with nu degrees of freedom —
Note: for :quick, see Table 6.4, page 225,
“Graphical Methods for Data Analysis”
by Chambers, Cleveland, Kleiner, & Tukey;
if :accurate, see AS 91, Applied Statistics

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-of-exponential-distribution (p)

given
[1] p (required)
==> a number > 0 and < 1
returns
[1] p-th quantile of exponential distribution with mean 1 —
Note: Table 6.4, page 225, “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner, & Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-of-gamma-distribution (alpha p)

given
[1] alpha (required)
==> shape parameter for gamma distribution
[2] p (required)
==> a number > 0 and < 1
returns
[1] p-th quantile of standard gamma distribution

Note: Table 6.4, page 225, “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner, & Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-of-kolmogorov-test-statistic (sample-size &key significance-level)

given
[1] sample-size (required)
==> a positive integer
[2] significance-level (keyword; 0.95)
==> 0.99, 0.98, 0.95, 0.90, or 0.80;
0.75 is also ok if sample-size > 40
returns
[1] quantile of two-sided Kolmogorov test statistic —
Note: see Table 14, page 462, of Conover (2nd edition, 1980); Stephens (1974); and Diggle (1990, page 55); significance-level is currently limited to one of these values: 0.99, 0.98, 0.95, 0.90, or 0.80;
if sample-size is greater than 40, 0.75 is also ok

Package

sapa.

Source

nonparametric.lisp.

Function: quantile-of-normal-distribution (p &key accuracy-level)

given
[1] p (required)
==> a number > 0 and < 1
[2] accuracy-level (keyword; :quick)
==> if :quick, gives quick approximation;
if :better, gives slower, but better, approximation; if :accurate, uses slowest, but more accurate, approximation;
returns
[1] quantile of standard normal distribution;

Note: for :quick, see Table 6.5, page 227,
“Graphical Methods for Data Analysis”
by Chambers, Cleveland, Kleiner, & Tukey;
for :better, see Sections 26.2.22 and 26.2.23
of Abramowitz and Stegun;
for :accurate, see AS 111 by Beasley and Springer, Applied Statistics, 1977, vol. 26, p.118

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-of-ordered-seq (the-seq p)

given
[1] the-seq (required)
==> a sequence of real-valued numbers,
ordered from smallest to largest
[2] p (required)
==> a percentile; i.e., 0 <= p <= 1
returns
[1] the sample quantile for p

Note: see Section 2.2 of “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner, and Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: quantile-plot (a-seq &key a-seq-sorted-p)

given
[1] a-seq (required)
==> any sequence of real-valued numbers
[2] a-seq-sorted-p (keyword; nil)
==> if t, a-seq is already sorted;
if nil, a copy of a-seq is sorted
for use by the function
returns
[1] sequence with sample quantiles for a-seq
[2] sequence with corresponding percentiles

Note: see Section 2.2 of “Graphical Methods for Data Analysis” by Chambers, Cleveland, Kleiner, and Tukey

Package

sapa.

Source

basic-statistics.lisp.

Function: ranorm ()

returns a random deviate from a normal distribution with zero mean and unit variance

Package

sapa.

Source

random.lisp.

Function: ranorms (n &key result)

given:
[1] n (required)
==> number of normal random deviates
to be generated
[2] result (keyword; vector of length n)
<== vector to hold random deviates returns:
[1] result, a vector with n normal random deviates (i.e., a realization of length n of a white noise process from a normal distribution)

Package

sapa.

Source

random.lisp.

Function: reflection-coeffs->ar-coeffs (reflection-coeffs &key p scratch result)

given
[1] reflection-coeffs (required)
==> vector of length p with real-valued reflection coefficients
phi_{1,1}, phi_{2,2}, ... , phi_{p,p}
[2] p (keyword; length of reflection-coeffs)
==> AR model order
[3] scratch (keyword; vector of length p)
==> vector of size p used for intermediate results [4] results (keyword; vector of length p)
<== vector of size p into which are placed
the AR coefficients phi_{j,p} for model
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2} + ... + phi_{p,p} * x_{t-p} + e_t returns
[1] results, i.e., the AR coefficients

Note: see Section 9.4 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: reflection-coeffs->variance (reflection-coeffs innovations-variance &key p)

given
[1] reflection-coeffs (required)
==> vector of length p with real-valued reflection coefficients phi_{1,1}, phi_{2,2}, ... , phi_{p,p} [2] innovations-variance (required)
==> innovations variance of the process [3] p (keyword; length of reflection-coeffs) ==> AR model order
returns
[1] variance of the process

Note: this is a recursive application of Equation (404c) of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: regression-with-ar-errors (time-series ind-vars p &key ar-coeff-estimator maximum-number-of-iterations eps trace-ar-parameter-estimates-p trace-ls-parameter-estimates-p)

given
[1] time-series (required)
==> a vector with dependent variables
[2] ind-vars (required)
==> a list of vector(s) with independent variable(s) [3] p (required)
==> autoregressive order
[4] AR-coeff-estimator (keyword; #’burg-algorithm)
==> AR estimation procedure
[5] maximum-number-of-iterations (keyword; 5)
==> ... like I said ...
[6] eps (keyword; 1.0e-7)
==> a small number – used to test for convergence in estimates of both regression and AR coefficients [7] trace-AR-parameter-estimates-p (keyword; nil)
==> if t, results of each iteration
on AR parameters are printed
[8] trace-LS-parameter-estimates-p (keyword; nil)
==> if t, results of each iteration
on least squares parameters are printed
returns
[1] estimates of least squares coefficients
[2] estimates of AR coefficients
[3] variance of residuals
[4] either number of iterations required for convergence or nil if maximum number of iterations completed but convergence not yet achieved

Note: this function is based on Newton, TIMESLAB, page 241; it has NOT been thoroughly tested (particularly with regard to the convergence criterion),
so a heavy dose of the usual “caveat emptor”
is appropriate here!!!

Package

sapa.

Source

parametric.lisp.

Function: running-median (time-series k &key result)

given
[1] time-series (required)
==> a sequence of numbers
[2] K (required)
==> positive integer giving the number of points in the running median
[3] result (keyword; vector of appropriate length) <== a sequence to hold running medians
of time series
return
[1] result, the vector of running medians
of K consecutive points

Package

sapa.

Source

filtering.lisp.

Function: sample-cepstrum (log-spectrum &key sampling-time zero-frequency-p nyquist-frequency-p result)

given
[1] log-spectrum (required)
==> a vector containing log spectrum
[2] sampling-time (keyword; 1.0)
==> the sample time (i.e., delta t)
[3] zero-frequency-p (keyword; nil)
==> if t, the first element of log-spectrum
is associated with 0 frequency;
if nil, first element goes with
lowest nonzero frequency
[4] Nyquist-frequency-p (keyword; nil)
==> if t, the last element of log-spectrum
is associated with Nyquist frequency;
if nil, last element goes with
a frequency just less than Nyquist
[5] result (keyword; vector of appropriate length)
<== vector to hold sample cepstrum
returns
[1] result, i.e., the sample cepstrum from lag 0 to lag N_U
where N_U = length of log-spectrum - 1 if zero-frequency-p is t or = length of log-spectrum if zero-frequency-p is nil —
Note: see Equation 282 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: sample-correlation-coefficient (seq-1 seq-2 &key start end)

given
[1] seq-1 (required)
==> a sequence of real-valued numbers [2] seq-2 (required)
==> another sequence of real-valued numbers; should have the same length as seq-1 [3] start (keyword; 0)
==> start index of sequence to be used [4] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sample correlation coefficient
between two sequences

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-from-a-function (a-function &key seq-of-x-values x0 delta-x n)

given
[1] a-function (required)
==> a function to be sampled from
[2] seq-of-x-values (keyword; ’())
==> sequence of values at which a-function
is to be sampled (default ’())
[3] x0 (keyword; 0.0)
==> point of first value to be sampled
[4] delta-x (keyword; 1.0)
==> increment between points
[5] n (keyword; length of seq-of-x-values)
==> number of samples
returns
[1] an array with the values of a-function
at a specified set of points; and
[2] an array with the specified set of points.

Note that the specified set of points either is in seq-of-x-values – if it is non-nil – or is given by
x0, x0 + delta-x, x0 + 2*delta-x, ..., x0 + (n-1)*delta-x

Package

sapa.

Source

utilities.lisp.

Function: sample-mean (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real or complex-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used
[3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sample mean of the specified numbers
in the-seq

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-mean-and-variance (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real or complex-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used
[3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sample mean of the specified numbers
in the-seq
[2] sample variance of the specified numbers
in the-seq

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-median (the-seq &key start end the-seq-is-ordered-p)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used [4] the-seq-is-ordered-p (keyword; nil) ==> if t, the-seq is assumed to
be sorted from smallest to largest value; if nil, the-seq will be sorted returns
[1] sample median
[2] minimum value in sequence
[3] maximum value
[4] sorted sequence

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-skewness-and-kurtosis (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sample skewness of the specified numbers in the-seq
[2] sample kurtosis
[3] sample mean
[4] sample variance

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-variance (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of real or complex-valued numbers [2] start (keyword; 0)
==> start index of sequence to be used
[3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sample variance of the specified numbers
in the-seq

Package

sapa.

Source

basic-statistics.lisp.

Function: sample-variogram (time-series times)

given:
[1] time-series (required)
==> a vector containing the time series [2] times (required)
==> a vector containing the associated times returns
[1] the sample variogram
[2] associated lags

Note: see Diggle’s book

Package

sapa.

Source

acvs.lisp.

Function: sampling-time->nyquist-frequency (sampling-time)

given a sampling time, returns the associated Nyquist frequency —
Note: see page 98 of the SAPA book

Package

sapa.

Source

utilities.lisp.

Function: sdf->sdf-with-accurate-peaks (sdf freqs ar-coeffs innovations-variance &key sampling-time sdf-transformation search-method db-tolerance accuracy maximum-number-of-iterations)

given
[1] sdf (required)
==> vector with sdf for a real-valued process
computed over a grid of frequencies (the grid
need not be uniform) – note that the sdf values
can be either untransformed or transformed via
an order preserving transformation (such as decibels)
[2] freqs (required)
==> vector with frequencies corresponding to values
in sdf (must be same size as vector with sdf values)
[3] AR-coeffs (required)
==> vector with real-valued AR coefficients phi_{j,p}
for an AR(p) model of order p:
x_t = phi_{1,p} * x_{t-1} + phi_{2,p} * x_{t-2}
+ ... + phi_{p,p} * x_{t-p} + e_t
[4] innovations-variance (required)
==> innovations variance of the process
[5] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[6] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform any newly computed values of the sdf
[7] search-method (keyword; :quadratic-approx)
==> selects between two methods to search
for the location of peaks;
if set to :quadratic-approx, a quadratic approximation is used; if set to :bisection+Newton-Raphson, an interval search using a combination of bisection and Newton-Raphson is used [8] dB-tolerance (keyword; 0.1)
==> convergence criterion (used if search-method
is :quadratic-approx)
[9] accuracy (keyword; 10 * single-float-epsilon)
==> convergence criterion (used if search-method
is :bisection+Newton-Raphson)
[10] maximum-number-of-iterations (keyword; 20)
==> controls the number of iterations (used if search-method
is :bisection+Newton-Raphson)
returns
[1] a vector with values of sdf merged
with an additional set of values
chosen to represent peaks accurately
[2] the corresponding augmented vector of frequencies
[3] the length of the two vector returned

Note: see pages 524–5 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: secant-method (f x-left x-right &key accuracy maximum-number-of-iterations)

given
[1] f (required)
==> a function with a single argument
[2] x-left (required)
==> left-hand bracket for the desired root; i.e., left-hand bracket <= desired root [3] x-right (required)
==> right-hand bracket for the desired root; i.e., desired root <= right-hand bracket [4] accuracy (keyword; (* 10.0 single-float-epsilon)) ==> desired relative accuracy for computed rood [5] maximum-number-of-iterations (keyword; 50) ==> maximum number of iterations
returns
[1] a root of f in [x-left, x-right];
i.e., a value x in that interval
such that f(x) = 0
[2] the number of iterations required

Note: this function is based loosely on rtsec, Section 9.2, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: sign (a1 a2)

implementation of Fortran SIGN function

Package

sapa.

Source

utilities.lisp.

Function: simple-numerical-integration (f a b &key accuracy maximum-number-of-iterations)

given
[1] f (required)
==> a function with a single argument
[2] a (required)
==> left-hand limit for numerical integration [3] b (required)
==> right-hand limit for numerical integration i.e., a < b
[4] accuracy (keyword; 1.0e-6)
==> desired relative accuracy for computed rood [5] maximum-number-of-iterations (keyword; 20) ==> maximum number of iterations
returns
[1] the integral of f over the interval [a, b] [2] the number of iterations required

Note: this function is based on qtrap,
Section 4.2, Numerical Recipes, Second Edition

Package

sapa.

Source

basic-math.lisp.

Function: simulate-time-series-from-sdf (n-series sdf &key sampling-time n-total result)

given
[1] n-series (required)
==> length of time series to be simulated
[2] sdf (required)
==> spectral density function (sdf) defined for
0 <= f <= 1/(2.0 sampling-time) – the
sdf is assumed to be two-sided and symmetric
about f = 0
[3] sampling-time (keyword; 1.0)
==> the assumed sampling time (delta t)
[4] n-total (keyword; 4 * next power of 2 for n-series)
==> a power of 2 controlling degree of accuracy
of the approximation (the larger, the better –
see Percival, 1992, for details)
[5] result (keyword; vector of length n-series)
<== a vector to contain simulated time series
returns
[1] a vector of length n-series generated from sdf

Note: the method used here is an approximate frequency domain technique; in particular, it will NOT simulate the DC component correctly, so beware of using this function in studies where the process mean is of important

Package

sapa.

Source

random.lisp.

Function: smoothing-window-for-lag-window-spectral-estimate (sample-size lag-window-function &key n-nonzero-freqs sampling-time scratch-dft smooth-wind-transformation result-smooth-wind return-frequencies-p freq-transformation result-freq)

given
[1] sample-size (required)
==> sample size for which smoothing window is to be computed [2] lag-window-function (required)
==> function of a single variable that computes the value
of the lag window for a given lag
[3] N-nonzero-freqs (keyword; :twice-next-power-of-2)
==> specifies at how many nonzero frequencies
smoothing window is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [4] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[5] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[6] smooth-wind-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-smooth-wind
[7] result-smooth-wind (keyword; vector of correct length)
<== vector into which smoothing window values are placed;
it must be exactly of the length dictated by N-nonzero-freqs [8] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the smoothing window are computed and returned in result-freq
[9] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[10] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of N-nonzero-freqs +1 into which
the frequencies associated with the values
in result-smooth-wind are placed
returns
[1] result-smooth-wind, a vector holding
the properly transformed smoothing window
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-smooth-wind
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-smooth-wind

Note: see equation below Equation (237c) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: spectral-window-for-direct-spectral-estimate (sample-size &key n-nonzero-freqs sampling-time scratch-dft data-taper data-taper-parameters spec-wind-transformation result-spec-wind return-frequencies-p freq-transformation result-freq)

given
[1] sample-size (required)
==> sample size for which spectral window is to be computed [2] N-nonzero-freqs (keyword; :twice-next-power-of-2)
==> specifies at how many nonzero frequencies
spectral window is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [3] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[4] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[5] data-taper (keyword; nil)
==> nil or a tapering function
[6] data-taper-parameters (keyword)
==> parameters for tapering function (not used
if data-taper is nil)
[7] spec-wind-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-spec-wind
[8] result-spec-wind (keyword; vector of correct length)
<== vector into which spectral window values are placed;
it must be exactly of the length dictated by N-nonzero-freqs [9] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral window are computed and returned in result-freq
[10] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
[11] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of N-nonzero-freqs +1 into which
the frequencies associated with the values
in result-spec-wind are placed
returns
[1] result-spec-wind, a vector holding
the properly transformed spectral window
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-spec-wind
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-spec-wind

Note: see equation below Equation (207a) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: spectral-window-for-lag-window-spectral-estimate (sample-size lag-window-function &key n-nonzero-freqs sampling-time scratch-dft data-taper data-taper-parameters spec-wind-transformation result-spec-wind return-frequencies-p freq-transformation result-freq)

given
[1] sample-size (required)
==> sample size for which spectral window is to be computed [2] lag-window-function (required)
==> function of a single variable that computes the value
of the lag window for a given lag
[3] N-nonzero-freqs (keyword; :twice-next-power-of-2)
==> specifies at how many nonzero frequencies
spectral window is to be computed – choices are: :half-next-power-of-2
==> 1/2 * power of two >= sample size; :next-power-of-2
==> power of two >= sample size; :twice-next-power-of-2
==> 2 * power of two >= sample size; :Fourier
==> just at Fourier frequencies
– or –
any power of 2 >= 1/2 * [power of two >= sample size] [4] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[5] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[6] data-taper (keyword; nil)
==> nil or a tapering function
[7] data-taper-parameters (keyword)
==> parameters for tapering function (not used
if data-taper is nil)
[8] spec-wind-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-spec-wind
[9] result-spec-wind (keyword; vector of correct length)
<== vector into which spectral window values are placed;
it must be exactly of the length dictated by N-nonzero-freqs [10] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral window are computed and returned in result-freq
[11] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[12] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of N-nonzero-freqs +1 into which
the frequencies associated with the values
in result-spec-wind are placed
returns
[1] result-spec-wind, a vector holding
the properly transformed spectral window
[2] result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the properly transformed frequencies
associated with values in result-spec-wind
– or –
nil (if return-frequencies-p is nil)
[3] the length of the vector result-spec-wind

Note: see equation below Equation (244a) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: spofa! (a &key n)

given
[1] A (required)
<=> real symmetric positive definite matrix (this gets trashed)
[2] n (keyword; (array-dimensions a))
==> size of matrix to be factored calculates the upper triangular matrix U
of the Cholesky decomposition A = LU,
where L = U^T, and
returns
[1] U, stored in upper triangular part of A

Package

sapa.

Source

matrix.lisp.

Function: sposl! (a b &key n)

given
[1] A (required)
==> real symmetric positive definite matrix
AFTER it has been crunched by spofa!
[2] b (required)
<=> the right-hand side vector on input;
on output, this gets replaced by the solution X [3] N (keyword; length of b)
==> order of matrix A (default is length of b) returns
[1] X, the solution to A X = b; note that X is the same as the vector which contained b

Package

sapa.

Source

matrix.lisp.

Function: standard-normal-pdf (x)

given x, returns value of standard normal pdf at x

Package

sapa.

Source

basic-statistics.lisp.

Function: step-down-levinson-durbin-recursions (coeffs variance &key process-variance-p)

given
[1] coeffs (required)
==> sequence of length p with AR coefficients:
x_t = coeffs_0*x_{t-1} + coeffs_1*x_{t-2}
+ ... + coeffs_{p-1}*x_{t-p} + e_t
(see Equation (392a) in the SAPA book;
the coefficients can be real or complex-valued)
[2] variance (required)
==> process variance or innovations variance
(see keyword process-variance-p)
[3] process-variance-p (keyword; t)
==> if t, variance is taken to be process variance
if nil, variance is taken to be innovations variance
computes best linear prediction coefficients of orders 1, 2, ..., p-1 and prediction error variances of orders 0 (process variance), 1, ..., p and returns
[1] list of vectors with best linear prediction coefficients
going from order 1 to order p;
[2] list of prediction error variances going from order 0 to order p —
Note: see item [4] of the Comments and Extensions
to Section 9.4 of the SAPA book. The values returned by
this function can be used to set the keyword parameters list-of-lower-order-phi and list-of-lower-order-pev in
the function generate-ar-time-series

Package

sapa.

Source

random.lisp.

Function: subtract-two-matrices (a-matrix b-matrix &key result)

given
[1] a-matrix (required)
==> a 2d matrix
[2] b-matrix (required)
==> a 2d matrix, with dimensions the same
as a-matrix
[3] result (keyword; new vector of appropriate size) <== a matrix to contain result of subtracting b-matrix from a-matrix
returns
[1] a-matrix minus b-matrix (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: sum (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of numbers
[2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sum of elements in specified subsequence

Package

sapa.

Source

utilities.lisp.

Function: sum-of-squares (the-seq &key start end)

given
[1] the-seq (required)
==> a sequence of numbers
[2] start (keyword; 0)
==> start index of sequence to be used [3] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] sum of squares of elements
in specified subsequence

Package

sapa.

Source

utilities.lisp.

Function: supplied-data-taper! (a-time-series &key taper-parameter normalization result)

given
[1] a-time-series (required)
<=> a vector containing a time series;
this vector is modified UNLESS keyword result
is bound to a different vector
[2] taper-parameter (keyword; vector with Hanning taper) ==> a vector containing the supplied data taper
(must be the same length as a-time-series); unmodified upon return
[3] normalization (keyword; :unity)
==> if :unity, taper normalized such that
its sum of squares is equal to unity (Equation (208a)); if :N, taper normalized such that
its sum of squares is equal to the number of points in the time series
[4] result (keyword; a-time-series)
<=> a vector to contain time series multiplied
by the supplied data taper
returns
[1] a vector containing the tapered time series
[2] C_h, the variance inflation factor
computed using Equation (251b) in the SAPA book

Package

sapa.

Source

tapers.lisp.

Function: symmetry-plot (a-seq &key a-seq-sorted-p)

given
[1] a-seq (required)
==> any sequence of real-valued numbers [2] a-seq-sorted-p (keyword; nil)
==> if t, a-seq is already sorted; if nil, a copy of a-seq is sorted for use by the function
returns
[1] y values for a symmetry plot for a-seq [2] x values for a symmetry plot for a-seq

Package

sapa.

Source

basic-statistics.lisp.

Function: tail-area-of-normal-distribution (q &key q-to-infinity-p)

given
[1] q (required)
==> a quantile
[2] q-to-infinity-p (keyword; nil)
==> if t, return integral from q to +infinity; if nil, return integral from -infinity to q return
tail area of the standard norm from
either q to +infinity (if q-to-infinity-p is true) or -infinity to q (if q-to-infinity-p is nil) —
see Algorithm AS-66, Applied Statistics,
1973, vol. 22, no. 3

Package

sapa.

Source

basic-statistics.lisp.

Function: thomson-weight-function (x &key beta symmetric-version)

given
[1] x (required)
==> value at which to evaluate Thomson’s
weight function
[2] beta (keyword; 1.0)
==> tuning parameter
[3] symmetric-version (keyword; t)
==> one-sided or two-sided down weightings
returns
[1] value of Thomson’s weight function at x

Note: Equation (27), p. 637 of Chave, Thomson, and Ander (1987)

Package

sapa.

Source

basic-statistics.lisp.

Function: three-point-smoother (a-seq)

given a sequence of length N,
returns a sequence of length N-2 formed by filtering the input sequence with a three-point filter with coefficients 1/4, 1/2 and 1/4

Note: see Section 5.7 of the SAPA book

Package

sapa.

Source

filtering.lisp.

Function: time-series-bandwidth (acvs &key sampling-time)

given
[1] acvs (required)
==> a vector of length N with values of
the acvs (or acs) from lag 0 to N-1
[2] sampling-time (keyword; 1.0)
==> the sampling time
returns
[1] unbiased estimate of trace bandwidth
(tilde B_T in Equation (280))
[2] biased estimate of trace bandwidth
(hat B_T in equation just above Equation (28))) —
Note: see Section 6.14 of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: trace-matrix (a-matrix)

given a square matrix, returns its trace

Package

sapa.

Source

matrix.lisp.

Function: transfer-function-for-filter (the-filter &key tf-transformation actual-index-of-1st-filter-coeff n-fft return-frequencies-p nyquist-frequency result-tf result-freq)

given
[1] the-filter (required)
==> a vector of filter coefficients
[2] tf-transformation (keyword; mod squared in dB with 0 mapped to -100 dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all of the elements of the transfer function
[3] actual-index-of-1st-filter-coeff (keyword; 0)
==> the filter coefficient in (aref the-filter 0) is assumed
to have an index equal to whatever is given here
(this is only needed if the phase of the transfer function
is needed)
[4] N-fft (keyword; 4 * (next-power-of-2 (length the-filter)))
==> the length of vector to be used in the fast Fourier transform
– the larger this is, the finer the grid of frequencies
over which the transfer function is computed; this number
MUST be a power of 2.
[5] return-frequencies-p (keyword; nil)
==> if t, the frequencies associated with the transfer function
are computed and returned in result-freq
[6] Nyquist-frequency (keyword; 0.5)
==> the Nyquist frequency
[7] result-tf (keyword; vector of length (1+ (/ N-fft 2)))
<== vector of length (1+ (/ N-fft 2))
into which the properly transformed transfer function
is placed (returned by the function)
[8] result-freq (keyword; vector of length (1+ (/ N-fft 2)) if return-frequencies-p t) <== vector of length (1+ (/ N-fft 2))
into which the frequencies associated with the values
in result-tf are placed if return-frequencies-p is true
(returned by the function)
returns
[1] result-tf, a vector holding
the properly transformed transfer function
[2] nil (if return-frequencies-p is nil) or
result-freq (if return-frequencies-p is t),
where result-freq is a vector holding
the frequencies associated with values
in result-tf

Note: see Section 5.3 of the SAPA book

Package

sapa.

Source

filtering.lisp.

Function: transform-a-sequence (a-function the-seq)

given
[1] a-function (required)
==> a function with one argument
[2] the-seq (required)
==> a sequence of numbers
returns
[1] a sequence of numbers obtained by applying a-function to each element of the-seq

Package

sapa.

Source

utilities.lisp.

Function: transform-a-sequence! (a-function the-seq &key result)

given
[1] a-function (required)
==> a function with one argument
[2] the-seq (required)
==> a sequence of numbers
[3] result (keyword; the-seq)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by applying a-function to each element of the-seq

Package

sapa.

Source

utilities.lisp.

Function: transpose (a-matrix &key result)

given
[1] A (required)
==> a 2d matrix
[2] result (keyword; new 2d array of appropriate size) <== a 2d matrix to contain transpose of a-matrix returns
[1] transpose of a-matrix (placed in result)

Package

sapa.

Source

matrix.lisp.

Function: triangular-convergence-factors (k filter-length)
Package

sapa.

Source

filtering.lisp.

Function: trig-prolate-tapers (n number-of-tapers &key taper-parameter print-progress-p compute-true-eigenvalues-p)

given
[1] N (required)
the sample size
[2] number-of-tapers (required)
number of orthonormal trig prolate tapers
to be computed; currently restricted to
one of the following maximum values:
2 if taper-parameter is 2;
4 if taper-parameter is 3;
5 if taper-parameter is 4;
7 if taper-parameter is 5
[3] taper-parameter (keyword; 4.0)
NW, the duration-half-bandwidth product;
currently restricted to one of the
following integers: 2, 3, 4, 5
(must also be such that 0 < NW/N < 1/2)
[4] print-progress-p (keyword; nil)
if t, prints a dot after each taper
has been computed
[5] compute-true-eigenvalues-p (keyword; nil)
if t, returns eigenvalues for eigenproblem
of Equation (378) of the SAPA book;
if nil, returns nil
returns
[1] a list of length number-of-tapers of N dimensional vectors with orthonormal trig prolate data tapers of orders
0, 1, ..., number-of-tapers - 1;
[2] a vector of length number-of-tapers with
eigenvalues if compute-true-eigenvalues-p is t;
nil if if compute-true-eigenvalues-p is nil

Note: computes the trig prolate approximation to
the dpss tapers (see Section 8.4 of the SAPA book)

Package

sapa.

Source

multitaper.lisp.

Function: trigamma (x &key x-recursion)

given
[1] x (required)
==> a positive number
[2] x-recursion (keyword; 2.0)
==> if x < x-recursion,
recursive formula is used
returns
[1] value of trigamma function at x

Note: expansion 6.4.12 plus recurrence 6.4.6
of Abramowitz and Stegun;
better accuracy can be obtained by increasing x-recursion —10.0 to 30.0 is probably a useful upper limit

Package

sapa.

Source

basic-math.lisp.

Function: two-step-burg-algorithm (time-series p &key start end center-data ar-coeffs approximate-mses reflection-coeffs forward-prediction-errors backward-prediction-errors exact-mses)

given
[1] time-series (required)
==> a vector containing a real-valued or
complex-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an EVEN integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p}
[7] approximate-MSEs (keyword; a vector of length p+1)
<== estimates of innovations variance (mean square errors)
for models of order 0, 1, ..., p (the innovations variance
for the zeroth order model is the sample variance)
[8] reflection-coeffs (keyword; a vector of length p)
<== estimates of reflection coefficients phi_{1,1}, ..., phi_{p,p} [9] forward-prediction-errors (keyword; a vector of length end - start - p) <== computed forward prediction errors
[10] backward-prediction-errors (keyword; a vector of length end - start - p) <== computed backward prediction errors
[11] exact-MSEs (keyword; a vector of length p+1)
<== another set of estimates of innovations variance
for models of order 0, 1, ..., p; these estimates
are based on Equation (419a) of the SAPA book
uses the two step Burg algorithm to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t
and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p}
[2] estimate of the innovations variance, i.e.,
the variance of the e_t’s; this number is also given in
(elt approximate-MSEs p)
[3] approximate-MSEs
[4] reflection-coeffs
[5] forward-prediction-errors
[6] backward-prediction-errors
[7] exact-MSEs

Note: see Section 9.5 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: upper-triangular-solve! (a b &key n)

given
[1] A (required)
==> upper n by n triangular matrix
(note: lower subdiagonal part of this matrix is ignored) [2] b (required)
<=> on input, the right-hand side vector;
on output, the solution X to A X = b
[3] n (keyword; length of b)
==> order of matrix A
returns
[4] X, the solution to A X = b, where X is the same as vector which contained b (note that A is left unchanged)

Package

sapa.

Source

matrix.lisp.

Function: var-predicted-mean-at-x (x covariance-matrix)

given
[1] x (required)
==> a number
[2] covariance-matrix (required)
==> covariance matrix for estimated intercept and slope as returned by weighted-linear-least-squares returns
[1] the variance of the predicted mean of y at x

Note: see page 56, Draper and Smith, 1966

Package

sapa.

Source

basic-statistics.lisp.

Function: var-predicted-y-at-x (x residual-variance covariance-matrix)

given
[1] x (required)
==> a number
[2] residual-variance (required)
==> the residual variance as returned
by weighted-linear-least-squares
[3] covariance-matrix (required)
==> covariance matrix for estimated
intercept and slope as returned
by weighted-linear-least-squares
returns
[1] the variance of the predicted value of y
at x

Note: see Equation (1.4.8), p. 24, Draper and Smith, 1966

Package

sapa.

Source

basic-statistics.lisp.

Function: weighted-linear-least-squares (y &key versus weights compute-residuals-p compute-covariance-matrix-p residuals)

given
[1] y (required)
==> a sequence with values of y_k’s, the dependent variable. [2] versus (keyword; equally spaced & centered values)
==> a sequence or function giving values of x_k’s,
the independent variable
[3] weights (keyword; nil)
==> if vector supplied, these are used as weights
on the observations (nil implies that all y_k’s
are equally weighted)
[4] compute-residuals-p (keyword; nil)
==> if t, residuals are computed
[5] compute-covariance-matrix-p (keyword; nil)
==> if t, calculates and returns 2x2 var/covar matrix [6] residuals (keyword; nil or vector)
<== a sequence to be stuffed with the residuals
(not used unless compute-residuals-p is true)
fits model y_k = alpha + beta * x_k, and
returns
[1] estimate of intercept alpha
[2] estimate of slope beta
[3] estimate of residual variance
[4] residuals (if compute-residuals-p is true)
[5] covariance matrix for parameter estimates
(if compute-covariance-matrix-p is true)

Note: see Chapter 2 of Draper and Smith, 1966

Package

sapa.

Source

basic-statistics.lisp.

Function: weighted-mean (the-seq &key weights start end)

given
[1] the-seq (required)
==> a sequence of real or complex-valued numbers [2] weights (keyword; nil)
==> a sequence with (- end start) values
to be used as weights; if set to nil, equal weights for all numbers
is assumed
[3] start (keyword; 0)
==> start index of sequence to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of sequence to be used returns
[1] the weighted average of the specified numbers in the-seq

Package

sapa.

Source

basic-statistics.lisp.

Function: window-width-from-silverman (a-seq)

given a-seq,
returns the window width for kernel pdf estimation given on page 48, Equation (3.31), of Silverman, 1986

Package

sapa.

Source

basic-statistics.lisp.

Function: wosa-spectral-estimate (time-series block-size &key proportion-of-overlap oversampling-factor center-data start end return-est-for-0-freq-p sampling-time scratch-dft data-taper data-taper-parameters restore-power-option-p sdf-transformation result-sdf return-sdf-estimates-for-each-block-p return-frequencies-p freq-transformation result-freq)

given
[1] time-series (required)
==> a vector of real-valued numbers
[2] block-size (required)
==> a power of two
[3] proportion-of-overlap (keyword; 0.5)
==> number greater than 0 and less than 1
[4] oversampling-factor (keyword; 1)
==> a factor that controls the number of frequencies
at which the wosa spectral estimate is computed;
this factor should be an integer power of two
such as 1, 2, 4, etc; for example,
1 yields Fourier frequencies for block-size;
2 yields grid twice as fine as Fourier frequencies;
4 yields griid 4 times as fine as Fourier frequencies; etc.
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, time-series is not centered
[6] start (keyword; 0)
==> start index of vector to be used
[7] end (keyword; length of time-series)
==> 1 + end index of vector to be used
[8] return-est-for-0-freq-p (keyword; nil)
==> if t, sdf is computed at zero frequency;
otherwise, it is not computed.
[9] sampling-time (keyword; 1.0)
==> sampling time (called delta t in the SAPA book)
[10] scratch-dft (keyword; vector of correct length)
==> vector in which the in-place dft is done
[11] data-taper (keyword; #’Hanning-data-taper!)
==> a tapering function or nil
[12] data-taper-parameters (keyword; nil)
==> parameters for tapering function (not used
if data-taper is nil); the default of nil
is appropriate for the Hanning data taper
because it does not have any parameters
[13] restore-power-option-p (keyword; t)
==> if t and data-taper is non-nil,
normalizes tapered series to have same
sum of squares as before tapering
[14] sdf-transformation (keyword; #’convert-to-dB)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-sdf
[15] result-sdf (keyword; vector of correct length)
<== vector into which wosa sdf estimate is placed;
it must be EXACTLY of the length dictated
by block-size, oversampling-factor and return-est-for-0-freq-p [16] return-sdf-estimates-for-each-block-p (keyword; t)
==> if t, individual spectra for each block are returned in a list; note that these spectra are untransformed
(i.e., the option sdf-transformation applies only
to the final wosa estimate)
[17] return-frequencies-p (keyword; t)
==> if t, the frequencies associated with the spectral estimate are computed and returned in result-freq
[18] freq-transformation (keyword; nil)
==> a function of one argument or nil;
if bound to a function, the function is used
to transform all elements of result-freq
(ignored unless return-frequencies-p is true)
[19] result-freq (keyword; nil or vector of correct length)
<== not used if return-frequencies-p nil; otherwise,
vector of length dictated by
block-size, oversampling-factor and return-est-for-0-freq-p into which the frequencies associated with the values
in result-sdf are placed
returns
[1] wosa spectral estimate
[2] associated frequencies
[3] equivalent degrees of freedom
[4] list of individual direct spectral estimates

Package

sapa.

Source

nonparametric.lisp.

Function: x*y (x y)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
returns
[1] a vector of numbers obtained by multiplying corresponding elements of x and y

Package

sapa.

Source

utilities.lisp.

Function: x*y! (x y &key result)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
[3] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by multiplying corresponding elements of x and y

Package

sapa.

Source

utilities.lisp.

Function: x+b (x b)

given
[1] x (required)
==> a sequence of numbers
[2] b (required)
==> a number
returns
[1] a vector of numbers obtained by adding b to each element of x

Package

sapa.

Source

utilities.lisp.

Function: x+b! (x b &key result)

given
[1] x (required)
==> a sequence of numbers
[2] b (required)
==> a number
[3] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by adding b to each element of x

Package

sapa.

Source

utilities.lisp.

Function: x+y (x y)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
returns
[1] a vector of numbers obtained by adding x and y together element by element

Package

sapa.

Source

utilities.lisp.

Function: x+y! (x y &key result)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
[3] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by adding x and y together element by element

Package

sapa.

Source

utilities.lisp.

Function: x-y (x y)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
returns
[1] a vector of numbers obtained by subtracting elements of y from corresponding elements of x

Package

sapa.

Source

utilities.lisp.

Function: x-y! (x y &key result)

given
[1] x (required)
==> a sequence of numbers
[2] y (required)
==> a sequence of numbers
[3] result (keyword; x)
<== a sequence of numbers
returns
[1] a sequence of numbers obtained by subtracting elements of y from corresponding elements of x

Package

sapa.

Source

utilities.lisp.

Function: yule-walker-algorithm-given-acvs (acvs p &key ar-coeffs approximate-mses reflection-coeffs)

given
[1] acvs (required)
==> a vector containing values of the acvs
for a real-valued time series x_t
from lag 0 up to (and including) p
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p}
[4] approximate-MSEs (keyword; a vector of length p+1)
<== estimates of innovations variance (mean square errors)
for models of order 0, 1, ..., p (the innovations variance for the zeroth order model is the sample variance)
[5] reflection-coeffs (keyword; a vector of length p)
<== estimates of reflection coefficients phi_{1,1}, ..., phi_{p,p} uses the Yule-Walker method to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t
and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p}
[2] estimate of the innovations variance, i.e.,
the variance of the e_t’s; this number is also given in
(elt approximate-MSEs p)
[3] approximate-MSEs
[4] reflection-coeffs

Note: see Sections 9.3 and 9.4 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: yule-walker-algorithm-given-data (time-series p &key start end center-data ar-coeffs approximate-mses reflection-coeffs forward-prediction-errors backward-prediction-errors)

given
[1] time-series (required)
==> a vector containing a real-valued time series x_t
[2] p (required)
==> autoregressive model order;
p should be an integer > 0 and < end - start
[3] start (keyword; 0)
==> start index of vector to be used
[4] end (keyword; length of the-seq)
==> 1 + end index of vector to be used
[5] center-data (keyword; t)
==> if t, subtract sample mean from time series;
if a number, subtracts that number from time series;
if nil, the effect of this function is to return
a copy of the relevant portion of time-series
[6] AR-coeffs (keyword; a vector of length p)
<== estimates of AR coefficients phi_{1,p}, ..., phi_{p,p}
[7] approximate-MSEs (keyword; a vector of length p+1)
<== estimates of innovations variance (mean square errors)
for models of order 0, 1, ..., p (the innovations variance
for the zeroth order model is the sample variance)
[8] reflection-coeffs (keyword; a vector of length p)
<== estimates of reflection coefficients phi_{1,1}, ..., phi_{p,p} [9] forward-prediction-errors (keyword; a vector of length end - start - p) <== computed forward prediction errors
[10] backward-prediction-errors (keyword; a vector of length end - start - p) <== computed backward prediction errors
uses the Yule-Walker method to estimate the phi’s in the model
x_t = phi_{1,p} x_{t-1} + ... + phi_{p,p} x_{t-p} + e_t
and returns
[1] AR-coeffs, a vector containing phi_{1,p}, ..., phi_{p,p}
[2] estimate of the innovations variance, i.e.,
the variance of the e_t’s; this number is also given in
(elt approximate-MSEs p)
[3] approximate-MSEs
[4] reflection-coeffs
[5] forward-prediction-errors
[6] backward-prediction-errors

Note: see p. 420 of the SAPA book

Package

sapa.

Source

parametric.lisp.

Function: zero-strict-lower-diagonal! (a-matrix)

given a square matrix,
zeros its lower diagonal and returns the modified square matrix

Package

sapa.

Source

matrix.lisp.

Function: zeros-of-polynomial (polynomial &key degree-of-polynomial the-roots maximum-number-of-iterations)

given
[1] polynomial (required)
==> sequence with coefficients of a polynomial;
(elt polynomial 0) must be nonzero
[2] degree-of-polynomial (keyword; (1- (length polynomial))) ==> degree of polynomial
[3] the-roots (keyword; array of length degree-of-polynomial) <== number of derivatives to be evaluated
[4] maximum-number-of-iterations (keyword; 25)
==> maximum number of iterations
returns
[1] t or nil, where t indicates that all went well, whereas nil indicates that convergence did not occur at end of specificed number of iterations
[2] the-roots, a vector with the required roots
of the polynomial

Package

sapa.

Source

basic-math.lisp.


4.2 Internals


4.2.1 Constants

Constant: +euler-constant+
Package

sapa.

Source

basic-math.lisp.

Constant: +log-pi+
Package

sapa.

Source

basic-math.lisp.

Constant: +ppchi2-aa+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c1+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c10+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c11+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c12+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c13+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c14+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c15+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c16+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c17+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c18+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c19+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c2+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c20+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c21+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c22+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c23+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c24+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c25+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c26+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c27+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c28+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c29+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c3+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c30+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c31+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c32+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c33+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c34+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c35+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c36+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c37+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c38+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c4+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c5+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c6+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c7+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c8+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-c9+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-e+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-pmax+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppchi2-pmin+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-a0+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-a1+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-a2+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-a3+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-b1+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-b2+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-b3+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-b4+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-c0+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-c1+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-c2+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-c3+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-d1+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +ppnd-d2+
Package

sapa.

Source

basic-statistics.lisp.

Constant: +sapa-10-over-log-10+
Package

sapa.

Source

utilities.lisp.

Constant: +sapa-2-pi+
Package

sapa.

Source

utilities.lisp.

Constant: +sapa-4-time-exp-of-1-over-4+
Package

sapa.

Source

random.lisp.

Constant: +sapa-4-time-exp-of-minus-1-point-35+
Package

sapa.

Source

random.lisp.

Constant: +sapa-minus-2-pi+
Package

sapa.

Source

utilities.lisp.

Constant: +sapa-sqrt-8-over-e+
Package

sapa.

Source

random.lisp.

Constant: +sqrt-of-two-pi+
Package

sapa.

Source

basic-statistics.lisp.


4.2.2 Special variables

Special Variable: *abscissas-32-point*
Package

sapa.

Source

multitaper.lisp.

Special Variable: *sapa-cached-pre-fft-arrays*
Package

sapa.

Source

dft-and-fft.lisp.

Special Variable: *weights-32-point*
Package

sapa.

Source

multitaper.lisp.

Special Variable: +coefficents-for-log-of-gamma+
Package

sapa.

Source

basic-math.lisp.

Special Variable: +nr-gser-eps+
Package

sapa.

Source

basic-statistics.lisp.

Special Variable: +nr-gser-itmax+
Package

sapa.

Source

basic-statistics.lisp.

Special Variable: +use-pre-fft-with-cache-p+
Package

sapa.

Source

dft-and-fft.lisp.


4.2.3 Ordinary functions

Function: absolute-sum-of-vector-elements (vector)
Package

sapa.

Source

parametric.lisp.

Function: as-111 (p)

adapted from AS 111 — FORTRAN routine ppnd

Package

sapa.

Source

basic-statistics.lisp.

Function: as-91 (p degrees-of-freedom)
Package

sapa.

Source

basic-statistics.lisp.

Function: as-91-block-1 (ch a g c)
Package

sapa.

Source

basic-statistics.lisp.

Function: as-91-block-4 (ch xx c p g)
Package

sapa.

Source

basic-statistics.lisp.

Function: bessi0-nr (x)
Package

sapa.

Source

tapers.lisp.

Function: binary-search-internal (value ordered-seq start end lower-test upper-test)
Package

sapa.

Source

utilities.lisp.

Function: calculate-number-of-blocks (sample-size block-size proportion-of-overlap)
Package

sapa.

Source

nonparametric.lisp.

Function: complex-of-absolutes (z)
Package

sapa.

Source

basic-math.lisp.

Function: continued-fraction-representation-for-incomplete-gamma (a x)
Package

sapa.

Source

basic-statistics.lisp.

Function: dpss->eigenvalue (dpss nw)

given dpss (a vector of length N) and NW, computes the corresponding eigenvalue using the method of Exercise [8.1], page 390, of the SAPA book

Package

sapa.

Source

multitaper.lisp.

Function: eigenvalues-and-vectors-of-sym-tridiag-matrix (diag off-diag &key maximum-number-of-iterations return-eigenvectors-p z)

given
[1] diag (required)
==> sequence of diagonal elements
(length of, say, n)
[2] off-diag (required)
==> sequence of off-diagonal elements
(length of n-1)
[3] maximum-number-of-iterations (keyword; 30)
==> maximum number of iterations
[4] return-eigenvectors-p (keyword; t)
==> if true, returns eigenvalues and eigenvectors; if nil, just do the eigenvalues (this is faster) [5] z (keyword; n by n diagonal matrix)
==> usually bound to output from Householder-reduction-of-real-sym-matrix returns
[1] vector with n eigenvalues
(NOT necessarily ordered by size)
[2] if return-eigenvectors-p is true, an n by n array whose jth column is the eigenvector corresponding to the jth eigenvalue; if return-eigenvectors-p is nil, that’s what you get!

This is based upon tqli in Numerical Recipes

Package

sapa.

Source

multitaper.lisp.

Function: equivalent-dof-for-wosa (n n_s n_b vector-with-data-taper)

given the sample size N, the block size N_S, the number of blocks N_B, and the values of the data taper,
returns the equivalent degrees of freedom for wosa
using Equation (292b) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: equivalent-dof-for-wosa-standard-case (n_s)

given number of blocks N_S,
returns the equivalent degrees of freedom for wosa with 50% overlap and Hanning data taper
using Equation (294) of the SAPA book

Package

sapa.

Source

nonparametric.lisp.

Function: eval-poly-2 (polynomial x)
Package

sapa.

Source

parametric.lisp.

Function: fast-tridiag-eigenvalue->dpss! (eigenvalue order-of-taper diag off-diag &key eps maximum-number-of-iterations b)
Package

sapa.

Source

multitaper.lisp.

Function: find-symmetric-frequency (f_1 f_2 f_3 f_n)
Package

sapa.

Source

parametric.lisp.

Function: flip-sign-of-coefficients! (a-sequence)
Package

sapa.

Source

parametric.lisp.

Function: generate-initial-guess-at-dpss (n order-of-taper &key half-size-p result)
Package

sapa.

Source

multitaper.lisp.

Function: generate-tri-prolate-taper (n generating-function)
Package

sapa.

Source

multitaper.lisp.

Function: get-n-dft (n-nonzero-freqs sample-size)
Package

sapa.

Source

nonparametric.lisp.

Function: get-n-freqs (n-nonzero-freqs sample-size return-est-for-0-freq-p)
Package

sapa.

Source

nonparametric.lisp.

Function: get-offset-to-kth-block (sample-size block-size number-of-blocks k)
Package

sapa.

Source

nonparametric.lisp.

Function: h-func (f g x)
Package

sapa.

Source

parametric.lisp.

Function: householder-reduction-of-real-sym-matrix! (real-sym-matrix &key prepare-for-eigenvectors-p)

given
[1] real-sym-matrix (required)
==> real, symmetric matrix (n by n)
[2] prepare-for-eigenvectors-p (keyword; t)
==> if true, crunch real-sym-matrix for use with eigenvalues-and-vectors-of-sym-tridiag-matrix returns
[1] n-dimensional vector with diagonal elements of associated tridiagonal matrix
[2] (n-1)-dimensional vector with off-diagonal elements of associated tridiagonal matrix

See tred2 in Numerical Recipes

Package

sapa.

Source

multitaper.lisp.

Function: incomplete-gamma (a x)

arguments:
a — parameter value > 0
x — variable >= 0
returns three values:
value of incomplete gamma function at a and x; the numerator (little gamma of a and x); the denominator (gamma of a);
see Section 6.2 of NR

Package

sapa.

Source

basic-statistics.lisp.

Function: incomplete-gamma-q (a x)

arguments:
a — parameter value > 0
x — variable >= 0
returns three values:
value of incomplete gamma function at a and x; the numerator (big gamma of a and x);
the denominator (gamma of a);
see Section 6.2 of NR

Package

sapa.

Source

basic-statistics.lisp.

Function: initial-estimates-for-zeros-of-polynomial (polynomial &key degree-of-polynomial initial-estimates scratch)
Package

sapa.

Source

basic-math.lisp.

Function: kth-eigenvalue-of-tridiagonal-matrix (diag off-diag k &key squared-off-diag macheps)
Package

sapa.

Source

multitaper.lisp.

Function: largest-eigenvalues-of-tridiagonal-matrix (diag off-diag number-of-tapers &key squared-off-diag macheps print-progress-p)
Package

sapa.

Source

multitaper.lisp.

Function: one-iteration-of-two-step-burg (k step n fk bk phi limit)
Package

sapa.

Source

parametric.lisp.

Function: power-of-2+1 (n)
Package

sapa.

Source

utilities.lisp.

Function: pre-fft (n &key complex-exp-vector)
Package

sapa.

Source

dft-and-fft.lisp.

Function: pre-fft-with-cache (n)
Package

sapa.

Source

dft-and-fft.lisp.

Function: produce-upsilon-func (coefficients)
Package

sapa.

Source

multitaper.lisp.

Function: series-representation-for-incomplete-gamma (a x)
Package

sapa.

Source

basic-statistics.lisp.

Function: sturm-sequence-count (test-lambda diag off-diag squared-off-diag machep &key start end)
Package

sapa.

Source

multitaper.lisp.

Function: symmetric-tridiagonal-infinity-norm (diag off-diag)
Package

sapa.

Source

multitaper.lisp.

Function: symmetric-tridiagonal-solve! (diag off-diag b)

given
[1] diag (required)
<=> diagonal part of symmetric tridiagonal matrix A; trash on output
[1] off-diag (required)
<=> off-diagonal part of symmetric tridiagonal matrix; trash on output
[2] b (required)
<=> on input, the right-hand side vector;
on output, the solution X to A X = b
returns
[4] X, the solution to A X = b, where X is the vector that contained b on input

Note: this is an implementation of Algorithm 4.3.6,
p. 156, Golub and Van Loan, 1989, with modifications
to avoid divides by zero

Package

sapa.

Source

multitaper.lisp.

Function: toeplitz (r y &optional x)

given
[1] r (required)
==> vector of length 2*N-1 representing
the Toeplitz matrix R(i,j) with 0 <= i,j <= N-1, via the 2*N-1 values
r(0,N-1), r(0,N-2),..., r(0,1),
r(0,0), r(1,0),..., r(N-1,0)
[2] y (required)
==> right-hand side vector of length N
[3] x (optional; vector of same size as y)
<== solution vector of length N
solves the Toeplitz system sum_{j=0}^{N-1} r_{N-1+i-j} x_j = y_j for i = 0, 1, ..., N-1 and
returns
[1] x (a vector of length N)
or
nil (in case of a failure of the Levinson method
due to a singular principal minor

Note: this function is essentially a Lisp version
of the Fortran routine toeplz from Numerical Recipes

Package

sapa.

Source

multitaper.lisp.

Function: trapezoidal-rule (f a b s n)
Package

sapa.

Source

basic-math.lisp.

Function: tridiag-eigenvalue->dpss! (eigenvalue order-of-taper diag off-diag &key eps maximum-number-of-iterations b)
Package

sapa.

Source

multitaper.lisp.

Function: trig-prolate-sign-cosine-coefficients (m k)
Package

sapa.

Source

multitaper.lisp.

Function: which-is-faster? (n-filter n-ts)
Package

sapa.

Source

filtering.lisp.

Function: wosa-get-n-freqs (block-size oversampling-factor return-est-for-0-freq-p)
Package

sapa.

Source

nonparametric.lisp.

Function: zeros-of-polynomial-with-initial-estimates (polynomial initial-estimates &key degree-of-polynomial scratch final-results maximum-number-of-iterations)
Package

sapa.

Source

basic-math.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   2  
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z  
Index Entry  Section

2
2d-matrix->linearized-upper-trangular: Public ordinary functions
2d-matrix-move!: Public ordinary functions

A
a*x: Public ordinary functions
a*x!: Public ordinary functions
a*x+b: Public ordinary functions
a*x+b!: Public ordinary functions
a*x+y: Public ordinary functions
a*x+y!: Public ordinary functions
absolute-sum-of-vector-elements: Private ordinary functions
acvs: Public ordinary functions
acvs-for-time-series-simulated-from-sdf: Public ordinary functions
add-sequences: Public ordinary functions
ar-coeffs->acvs: Public ordinary functions
ar-coeffs->prewhitening-filter: Public ordinary functions
ar-coeffs->reflection-coeffs: Public ordinary functions
ar-coeffs->sdf: Public ordinary functions
ar-coeffs->sdf-at-single-freq: Public ordinary functions
ar-coeffs->variance: Public ordinary functions
as-111: Private ordinary functions
as-91: Private ordinary functions
as-91-block-1: Private ordinary functions
as-91-block-4: Private ordinary functions

B
bandwidth&confidence-intervals-for-sdf-db: Public ordinary functions
bartlett-bandwidth->m: Public ordinary functions
bartlett-lag-window: Public ordinary functions
bartlett-m->bandwidth: Public ordinary functions
bartlett-n-m->degrees-of-freedom: Public ordinary functions
bessi0-nr: Private ordinary functions
biased-acvs->unbiased-acvs: Public ordinary functions
binary-search: Public ordinary functions
binary-search-internal: Private ordinary functions
bisection-with-newton-raphson: Public ordinary functions
box-plot: Public ordinary functions
burg-algorithm: Public ordinary functions

C
calculate-number-of-blocks: Private ordinary functions
careful-convert-to-db: Public ordinary functions
center&prewhiten&taper-time-series: Public ordinary functions
center&taper-time-series: Public ordinary functions
cepstrum->i_m: Public ordinary functions
check-orthonormality: Public ordinary functions
cholesky!: Public ordinary functions
circular-shift-sequence: Public ordinary functions
compare-seqs: Public ordinary functions
complex-of-absolutes: Private ordinary functions
compose-symmetric-filters: Public ordinary functions
continued-fraction-representation-for-incomplete-gamma: Private ordinary functions
convert-from-db: Public ordinary functions
convert-to-db: Public ordinary functions
copy-vector: Public ordinary functions
cosine-data-taper!: Public ordinary functions
create-ci-for-amt-sdf-estimate: Public ordinary functions
create-dpss-low-pass-filter: Public ordinary functions
create-least-squares-low-pass-filter: Public ordinary functions
cumulative-periodogram: Public ordinary functions
cumulative-sums: Public ordinary functions

D
daniell-bandwidth->m: Public ordinary functions
daniell-lag-window: Public ordinary functions
daniell-m->bandwidth: Public ordinary functions
daniell-n-m->degrees-of-freedom: Public ordinary functions
dft!: Public ordinary functions
dft-chirp!: Public ordinary functions
difference: Public ordinary functions
digamma: Public ordinary functions
direct-spectral-estimate: Public ordinary functions
divf: Public macros
dot-product: Public ordinary functions
dpss->eigenvalue: Private ordinary functions
dpss-data-taper!: Public ordinary functions
dpss-tapers-inverse-iteration: Public ordinary functions
dpss-tapers-thomson-approx: Public ordinary functions
dpss-tapers-tri-diag: Public ordinary functions
durbin-watson-test-statistic: Public ordinary functions

E
eigenspectra->adaptive-multitaper-spectral-estimate: Public ordinary functions
eigenspectra->multitaper-spectral-estimate: Public ordinary functions
eigenvalues-and-vectors-of-sym-tridiag-matrix: Private ordinary functions
equivalent-degrees-of-freedom: Public ordinary functions
equivalent-dof-for-wosa: Private ordinary functions
equivalent-dof-for-wosa-standard-case: Private ordinary functions
euclidean-norm: Public ordinary functions
eval-poly-2: Private ordinary functions
evaluate-polynomial: Public ordinary functions
exponential-smoothing: Public ordinary functions

F
factorial: Public ordinary functions
fast-forward-backward-ls: Public ordinary functions
fast-tridiag-eigenvalue->dpss!: Private ordinary functions
fft!: Public ordinary functions
filter-time-series: Public ordinary functions
filter-time-series-direct: Public ordinary functions
filter-time-series-fft: Public ordinary functions
find-peak-of-ar-sdf-using-quadratic-approx: Public ordinary functions
find-peak-or-valley-of-sdf-using-bisection+newton-raphson: Public ordinary functions
find-symmetric-frequency: Private ordinary functions
fisher-g-statistic: Public ordinary functions
flip-sign-of-coefficients!: Private ordinary functions
forward-backward-ls: Public ordinary functions
forward-ls: Public ordinary functions
Function, 2d-matrix->linearized-upper-trangular: Public ordinary functions
Function, 2d-matrix-move!: Public ordinary functions
Function, a*x: Public ordinary functions
Function, a*x!: Public ordinary functions
Function, a*x+b: Public ordinary functions
Function, a*x+b!: Public ordinary functions
Function, a*x+y: Public ordinary functions
Function, a*x+y!: Public ordinary functions
Function, absolute-sum-of-vector-elements: Private ordinary functions
Function, acvs: Public ordinary functions
Function, acvs-for-time-series-simulated-from-sdf: Public ordinary functions
Function, add-sequences: Public ordinary functions
Function, ar-coeffs->acvs: Public ordinary functions
Function, ar-coeffs->prewhitening-filter: Public ordinary functions
Function, ar-coeffs->reflection-coeffs: Public ordinary functions
Function, ar-coeffs->sdf: Public ordinary functions
Function, ar-coeffs->sdf-at-single-freq: Public ordinary functions
Function, ar-coeffs->variance: Public ordinary functions
Function, as-111: Private ordinary functions
Function, as-91: Private ordinary functions
Function, as-91-block-1: Private ordinary functions
Function, as-91-block-4: Private ordinary functions
Function, bandwidth&confidence-intervals-for-sdf-db: Public ordinary functions
Function, bartlett-bandwidth->m: Public ordinary functions
Function, bartlett-lag-window: Public ordinary functions
Function, bartlett-m->bandwidth: Public ordinary functions
Function, bartlett-n-m->degrees-of-freedom: Public ordinary functions
Function, bessi0-nr: Private ordinary functions
Function, biased-acvs->unbiased-acvs: Public ordinary functions
Function, binary-search: Public ordinary functions
Function, binary-search-internal: Private ordinary functions
Function, bisection-with-newton-raphson: Public ordinary functions
Function, box-plot: Public ordinary functions
Function, burg-algorithm: Public ordinary functions
Function, calculate-number-of-blocks: Private ordinary functions
Function, careful-convert-to-db: Public ordinary functions
Function, center&prewhiten&taper-time-series: Public ordinary functions
Function, center&taper-time-series: Public ordinary functions
Function, cepstrum->i_m: Public ordinary functions
Function, check-orthonormality: Public ordinary functions
Function, cholesky!: Public ordinary functions
Function, circular-shift-sequence: Public ordinary functions
Function, compare-seqs: Public ordinary functions
Function, complex-of-absolutes: Private ordinary functions
Function, compose-symmetric-filters: Public ordinary functions
Function, continued-fraction-representation-for-incomplete-gamma: Private ordinary functions
Function, convert-from-db: Public ordinary functions
Function, convert-to-db: Public ordinary functions
Function, copy-vector: Public ordinary functions
Function, cosine-data-taper!: Public ordinary functions
Function, create-ci-for-amt-sdf-estimate: Public ordinary functions
Function, create-dpss-low-pass-filter: Public ordinary functions
Function, create-least-squares-low-pass-filter: Public ordinary functions
Function, cumulative-periodogram: Public ordinary functions
Function, cumulative-sums: Public ordinary functions
Function, daniell-bandwidth->m: Public ordinary functions
Function, daniell-lag-window: Public ordinary functions
Function, daniell-m->bandwidth: Public ordinary functions
Function, daniell-n-m->degrees-of-freedom: Public ordinary functions
Function, dft!: Public ordinary functions
Function, dft-chirp!: Public ordinary functions
Function, difference: Public ordinary functions
Function, digamma: Public ordinary functions
Function, direct-spectral-estimate: Public ordinary functions
Function, dot-product: Public ordinary functions
Function, dpss->eigenvalue: Private ordinary functions
Function, dpss-data-taper!: Public ordinary functions
Function, dpss-tapers-inverse-iteration: Public ordinary functions
Function, dpss-tapers-thomson-approx: Public ordinary functions
Function, dpss-tapers-tri-diag: Public ordinary functions
Function, durbin-watson-test-statistic: Public ordinary functions
Function, eigenspectra->adaptive-multitaper-spectral-estimate: Public ordinary functions
Function, eigenspectra->multitaper-spectral-estimate: Public ordinary functions
Function, eigenvalues-and-vectors-of-sym-tridiag-matrix: Private ordinary functions
Function, equivalent-degrees-of-freedom: Public ordinary functions
Function, equivalent-dof-for-wosa: Private ordinary functions
Function, equivalent-dof-for-wosa-standard-case: Private ordinary functions
Function, euclidean-norm: Public ordinary functions
Function, eval-poly-2: Private ordinary functions
Function, evaluate-polynomial: Public ordinary functions
Function, exponential-smoothing: Public ordinary functions
Function, factorial: Public ordinary functions
Function, fast-forward-backward-ls: Public ordinary functions
Function, fast-tridiag-eigenvalue->dpss!: Private ordinary functions
Function, fft!: Public ordinary functions
Function, filter-time-series: Public ordinary functions
Function, filter-time-series-direct: Public ordinary functions
Function, filter-time-series-fft: Public ordinary functions
Function, find-peak-of-ar-sdf-using-quadratic-approx: Public ordinary functions
Function, find-peak-or-valley-of-sdf-using-bisection+newton-raphson: Public ordinary functions
Function, find-symmetric-frequency: Private ordinary functions
Function, fisher-g-statistic: Public ordinary functions
Function, flip-sign-of-coefficients!: Private ordinary functions
Function, forward-backward-ls: Public ordinary functions
Function, forward-ls: Public ordinary functions
Function, gauss-legendre-quadrature: Public ordinary functions
Function, generate-ar-time-series: Public ordinary functions
Function, generate-backward-innovations: Public ordinary functions
Function, generate-forward-innovations: Public ordinary functions
Function, generate-initial-guess-at-dpss: Private ordinary functions
Function, generate-ma-time-series: Public ordinary functions
Function, generate-tri-prolate-taper: Private ordinary functions
Function, generate-white-noise: Public ordinary functions
Function, get-n-dft: Private ordinary functions
Function, get-n-freqs: Private ordinary functions
Function, get-offset-to-kth-block: Private ordinary functions
Function, grenander-smoothing-window-bandwidth: Public ordinary functions
Function, h-func: Private ordinary functions
Function, hanning-data-taper!: Public ordinary functions
Function, hermitian-transpose: Public ordinary functions
Function, histogram: Public ordinary functions
Function, householder-reduction-of-real-sym-matrix!: Private ordinary functions
Function, huber-weight-function: Public ordinary functions
Function, ideal-band-pass-filter-irs: Public ordinary functions
Function, ideal-high-pass-filter-irs: Public ordinary functions
Function, ideal-low-pass-filter-irs: Public ordinary functions
Function, incomplete-gamma: Private ordinary functions
Function, incomplete-gamma-q: Private ordinary functions
Function, initial-estimates-for-zeros-of-polynomial: Private ordinary functions
Function, integrate-sdf: Public ordinary functions
Function, interquartile-range: Public ordinary functions
Function, inverse-dft!: Public ordinary functions
Function, inverse-fft!: Public ordinary functions
Function, iota: Public ordinary functions
Function, jenkins-smoothing-window-bandwidth: Public ordinary functions
Function, kernel-pdf-estimation: Public ordinary functions
Function, kth-eigenvalue-of-tridiagonal-matrix: Private ordinary functions
Function, lag-window-spectral-estimate: Public ordinary functions
Function, largest-eigenvalues-of-tridiagonal-matrix: Private ordinary functions
Function, linear-interpolation!: Public ordinary functions
Function, linearized-upper-trangular->2d-matrix: Public ordinary functions
Function, log-of-gamma: Public ordinary functions
Function, log10: Public ordinary functions
Function, lower-triangular-solve!: Public ordinary functions
Function, m-location-estimate: Public ordinary functions
Function, max-of-seq: Public ordinary functions
Function, median-absolute-deviation: Public ordinary functions
Function, min-and-max-of-seq: Public ordinary functions
Function, min-of-seq: Public ordinary functions
Function, modified-gram-schmidt!: Public ordinary functions
Function, multiply-2-polynomials: Public ordinary functions
Function, multiply-matrix-and-scalar: Public ordinary functions
Function, multiply-matrix-and-vector: Public ordinary functions
Function, multiply-polynomials: Public ordinary functions
Function, multiply-sequences: Public ordinary functions
Function, multiply-two-matrices: Public ordinary functions
Function, multitaper-spectral-estimate: Public ordinary functions
Function, n-applications-of-three-point-smoother: Public ordinary functions
Function, newton-raphson: Public ordinary functions
Function, next-power-of-2: Public ordinary functions
Function, nyquist-frequency->sampling-time: Public ordinary functions
Function, one-iteration-of-two-step-burg: Private ordinary functions
Function, one-sided-freq->two-sided-freq: Public ordinary functions
Function, one-sided-sdf->two-sided-sdf: Public ordinary functions
Function, ordinary-least-squares-cholesky: Public ordinary functions
Function, ordinary-least-squares-q-r: Public ordinary functions
Function, papoulis-bandwidth->m: Public ordinary functions
Function, papoulis-lag-window: Public ordinary functions
Function, papoulis-m->bandwidth: Public ordinary functions
Function, papoulis-n-m->degrees-of-freedom: Public ordinary functions
Function, parzen-bandwidth->m: Public ordinary functions
Function, parzen-lag-window: Public ordinary functions
Function, parzen-m->bandwidth: Public ordinary functions
Function, parzen-n-m->degrees-of-freedom: Public ordinary functions
Function, periodogram: Public ordinary functions
Function, periodogram-at-one-frequency: Public ordinary functions
Function, postcolor-spectral-estimate: Public ordinary functions
Function, power-of-2: Public ordinary functions
Function, power-of-2+1: Private ordinary functions
Function, pre-fft: Private ordinary functions
Function, pre-fft-with-cache: Private ordinary functions
Function, predicted-y-at-x: Public ordinary functions
Function, print-1-or-2-d-array: Public ordinary functions
Function, print-rows-of-nxm-matrix: Public ordinary functions
Function, produce-upsilon-func: Private ordinary functions
Function, q-q-plot: Public ordinary functions
Function, q-r!: Public ordinary functions
Function, quantile-of-chi-square-2-distribution: Public ordinary functions
Function, quantile-of-chi-square-distribution: Public ordinary functions
Function, quantile-of-exponential-distribution: Public ordinary functions
Function, quantile-of-gamma-distribution: Public ordinary functions
Function, quantile-of-kolmogorov-test-statistic: Public ordinary functions
Function, quantile-of-normal-distribution: Public ordinary functions
Function, quantile-of-ordered-seq: Public ordinary functions
Function, quantile-plot: Public ordinary functions
Function, ranorm: Public ordinary functions
Function, ranorms: Public ordinary functions
Function, reflection-coeffs->ar-coeffs: Public ordinary functions
Function, reflection-coeffs->variance: Public ordinary functions
Function, regression-with-ar-errors: Public ordinary functions
Function, running-median: Public ordinary functions
Function, sample-cepstrum: Public ordinary functions
Function, sample-correlation-coefficient: Public ordinary functions
Function, sample-from-a-function: Public ordinary functions
Function, sample-mean: Public ordinary functions
Function, sample-mean-and-variance: Public ordinary functions
Function, sample-median: Public ordinary functions
Function, sample-skewness-and-kurtosis: Public ordinary functions
Function, sample-variance: Public ordinary functions
Function, sample-variogram: Public ordinary functions
Function, sampling-time->nyquist-frequency: Public ordinary functions
Function, sdf->sdf-with-accurate-peaks: Public ordinary functions
Function, secant-method: Public ordinary functions
Function, series-representation-for-incomplete-gamma: Private ordinary functions
Function, sign: Public ordinary functions
Function, simple-numerical-integration: Public ordinary functions
Function, simulate-time-series-from-sdf: Public ordinary functions
Function, smoothing-window-for-lag-window-spectral-estimate: Public ordinary functions
Function, spectral-window-for-direct-spectral-estimate: Public ordinary functions
Function, spectral-window-for-lag-window-spectral-estimate: Public ordinary functions
Function, spofa!: Public ordinary functions
Function, sposl!: Public ordinary functions
Function, standard-normal-pdf: Public ordinary functions
Function, step-down-levinson-durbin-recursions: Public ordinary functions
Function, sturm-sequence-count: Private ordinary functions
Function, subtract-two-matrices: Public ordinary functions
Function, sum: Public ordinary functions
Function, sum-of-squares: Public ordinary functions
Function, supplied-data-taper!: Public ordinary functions
Function, symmetric-tridiagonal-infinity-norm: Private ordinary functions
Function, symmetric-tridiagonal-solve!: Private ordinary functions
Function, symmetry-plot: Public ordinary functions
Function, tail-area-of-normal-distribution: Public ordinary functions
Function, thomson-weight-function: Public ordinary functions
Function, three-point-smoother: Public ordinary functions
Function, time-series-bandwidth: Public ordinary functions
Function, toeplitz: Private ordinary functions
Function, trace-matrix: Public ordinary functions
Function, transfer-function-for-filter: Public ordinary functions
Function, transform-a-sequence: Public ordinary functions
Function, transform-a-sequence!: Public ordinary functions
Function, transpose: Public ordinary functions
Function, trapezoidal-rule: Private ordinary functions
Function, triangular-convergence-factors: Public ordinary functions
Function, tridiag-eigenvalue->dpss!: Private ordinary functions
Function, trig-prolate-sign-cosine-coefficients: Private ordinary functions
Function, trig-prolate-tapers: Public ordinary functions
Function, trigamma: Public ordinary functions
Function, two-step-burg-algorithm: Public ordinary functions
Function, upper-triangular-solve!: Public ordinary functions
Function, var-predicted-mean-at-x: Public ordinary functions
Function, var-predicted-y-at-x: Public ordinary functions
Function, weighted-linear-least-squares: Public ordinary functions
Function, weighted-mean: Public ordinary functions
Function, which-is-faster?: Private ordinary functions
Function, window-width-from-silverman: Public ordinary functions
Function, wosa-get-n-freqs: Private ordinary functions
Function, wosa-spectral-estimate: Public ordinary functions
Function, x*y: Public ordinary functions
Function, x*y!: Public ordinary functions
Function, x+b: Public ordinary functions
Function, x+b!: Public ordinary functions
Function, x+y: Public ordinary functions
Function, x+y!: Public ordinary functions
Function, x-y: Public ordinary functions
Function, x-y!: Public ordinary functions
Function, yule-walker-algorithm-given-acvs: Public ordinary functions
Function, yule-walker-algorithm-given-data: Public ordinary functions
Function, zero-strict-lower-diagonal!: Public ordinary functions
Function, zeros-of-polynomial: Public ordinary functions
Function, zeros-of-polynomial-with-initial-estimates: Private ordinary functions

G
gauss-legendre-quadrature: Public ordinary functions
generate-ar-time-series: Public ordinary functions
generate-backward-innovations: Public ordinary functions
generate-forward-innovations: Public ordinary functions
generate-initial-guess-at-dpss: Private ordinary functions
generate-ma-time-series: Public ordinary functions
generate-tri-prolate-taper: Private ordinary functions
generate-white-noise: Public ordinary functions
get-n-dft: Private ordinary functions
get-n-freqs: Private ordinary functions
get-offset-to-kth-block: Private ordinary functions
grenander-smoothing-window-bandwidth: Public ordinary functions

H
h-func: Private ordinary functions
hanning-data-taper!: Public ordinary functions
hermitian-transpose: Public ordinary functions
histogram: Public ordinary functions
householder-reduction-of-real-sym-matrix!: Private ordinary functions
huber-weight-function: Public ordinary functions

I
ideal-band-pass-filter-irs: Public ordinary functions
ideal-high-pass-filter-irs: Public ordinary functions
ideal-low-pass-filter-irs: Public ordinary functions
incomplete-gamma: Private ordinary functions
incomplete-gamma-q: Private ordinary functions
initial-estimates-for-zeros-of-polynomial: Private ordinary functions
integrate-sdf: Public ordinary functions
interquartile-range: Public ordinary functions
inverse-dft!: Public ordinary functions
inverse-fft!: Public ordinary functions
iota: Public ordinary functions

J
jenkins-smoothing-window-bandwidth: Public ordinary functions

K
kernel-pdf-estimation: Public ordinary functions
kth-eigenvalue-of-tridiagonal-matrix: Private ordinary functions

L
lag-window-spectral-estimate: Public ordinary functions
largest-eigenvalues-of-tridiagonal-matrix: Private ordinary functions
linear-interpolation!: Public ordinary functions
linearized-upper-trangular->2d-matrix: Public ordinary functions
log-of-gamma: Public ordinary functions
log10: Public ordinary functions
lower-triangular-solve!: Public ordinary functions

M
m-location-estimate: Public ordinary functions
Macro, divf: Public macros
Macro, multf: Public macros
max-of-seq: Public ordinary functions
median-absolute-deviation: Public ordinary functions
min-and-max-of-seq: Public ordinary functions
min-of-seq: Public ordinary functions
modified-gram-schmidt!: Public ordinary functions
multf: Public macros
multiply-2-polynomials: Public ordinary functions
multiply-matrix-and-scalar: Public ordinary functions
multiply-matrix-and-vector: Public ordinary functions
multiply-polynomials: Public ordinary functions
multiply-sequences: Public ordinary functions
multiply-two-matrices: Public ordinary functions
multitaper-spectral-estimate: Public ordinary functions

N
n-applications-of-three-point-smoother: Public ordinary functions
newton-raphson: Public ordinary functions
next-power-of-2: Public ordinary functions
nyquist-frequency->sampling-time: Public ordinary functions

O
one-iteration-of-two-step-burg: Private ordinary functions
one-sided-freq->two-sided-freq: Public ordinary functions
one-sided-sdf->two-sided-sdf: Public ordinary functions
ordinary-least-squares-cholesky: Public ordinary functions
ordinary-least-squares-q-r: Public ordinary functions

P
papoulis-bandwidth->m: Public ordinary functions
papoulis-lag-window: Public ordinary functions
papoulis-m->bandwidth: Public ordinary functions
papoulis-n-m->degrees-of-freedom: Public ordinary functions
parzen-bandwidth->m: Public ordinary functions
parzen-lag-window: Public ordinary functions
parzen-m->bandwidth: Public ordinary functions
parzen-n-m->degrees-of-freedom: Public ordinary functions
periodogram: Public ordinary functions
periodogram-at-one-frequency: Public ordinary functions
postcolor-spectral-estimate: Public ordinary functions
power-of-2: Public ordinary functions
power-of-2+1: Private ordinary functions
pre-fft: Private ordinary functions
pre-fft-with-cache: Private ordinary functions
predicted-y-at-x: Public ordinary functions
print-1-or-2-d-array: Public ordinary functions
print-rows-of-nxm-matrix: Public ordinary functions
produce-upsilon-func: Private ordinary functions

Q
q-q-plot: Public ordinary functions
q-r!: Public ordinary functions
quantile-of-chi-square-2-distribution: Public ordinary functions
quantile-of-chi-square-distribution: Public ordinary functions
quantile-of-exponential-distribution: Public ordinary functions
quantile-of-gamma-distribution: Public ordinary functions
quantile-of-kolmogorov-test-statistic: Public ordinary functions
quantile-of-normal-distribution: Public ordinary functions
quantile-of-ordered-seq: Public ordinary functions
quantile-plot: Public ordinary functions

R
ranorm: Public ordinary functions
ranorms: Public ordinary functions
reflection-coeffs->ar-coeffs: Public ordinary functions
reflection-coeffs->variance: Public ordinary functions
regression-with-ar-errors: Public ordinary functions
running-median: Public ordinary functions

S
sample-cepstrum: Public ordinary functions
sample-correlation-coefficient: Public ordinary functions
sample-from-a-function: Public ordinary functions
sample-mean: Public ordinary functions
sample-mean-and-variance: Public ordinary functions
sample-median: Public ordinary functions
sample-skewness-and-kurtosis: Public ordinary functions
sample-variance: Public ordinary functions
sample-variogram: Public ordinary functions
sampling-time->nyquist-frequency: Public ordinary functions
sdf->sdf-with-accurate-peaks: Public ordinary functions
secant-method: Public ordinary functions
series-representation-for-incomplete-gamma: Private ordinary functions
sign: Public ordinary functions
simple-numerical-integration: Public ordinary functions
simulate-time-series-from-sdf: Public ordinary functions
smoothing-window-for-lag-window-spectral-estimate: Public ordinary functions
spectral-window-for-direct-spectral-estimate: Public ordinary functions
spectral-window-for-lag-window-spectral-estimate: Public ordinary functions
spofa!: Public ordinary functions
sposl!: Public ordinary functions
standard-normal-pdf: Public ordinary functions
step-down-levinson-durbin-recursions: Public ordinary functions
sturm-sequence-count: Private ordinary functions
subtract-two-matrices: Public ordinary functions
sum: Public ordinary functions
sum-of-squares: Public ordinary functions
supplied-data-taper!: Public ordinary functions
symmetric-tridiagonal-infinity-norm: Private ordinary functions
symmetric-tridiagonal-solve!: Private ordinary functions
symmetry-plot: Public ordinary functions

T
tail-area-of-normal-distribution: Public ordinary functions
thomson-weight-function: Public ordinary functions
three-point-smoother: Public ordinary functions
time-series-bandwidth: Public ordinary functions
toeplitz: Private ordinary functions
trace-matrix: Public ordinary functions
transfer-function-for-filter: Public ordinary functions
transform-a-sequence: Public ordinary functions
transform-a-sequence!: Public ordinary functions
transpose: Public ordinary functions
trapezoidal-rule: Private ordinary functions
triangular-convergence-factors: Public ordinary functions
tridiag-eigenvalue->dpss!: Private ordinary functions
trig-prolate-sign-cosine-coefficients: Private ordinary functions
trig-prolate-tapers: Public ordinary functions
trigamma: Public ordinary functions
two-step-burg-algorithm: Public ordinary functions

U
upper-triangular-solve!: Public ordinary functions

V
var-predicted-mean-at-x: Public ordinary functions
var-predicted-y-at-x: Public ordinary functions

W
weighted-linear-least-squares: Public ordinary functions
weighted-mean: Public ordinary functions
which-is-faster?: Private ordinary functions
window-width-from-silverman: Public ordinary functions
wosa-get-n-freqs: Private ordinary functions
wosa-spectral-estimate: Public ordinary functions

X
x*y: Public ordinary functions
x*y!: Public ordinary functions
x+b: Public ordinary functions
x+b!: Public ordinary functions
x+y: Public ordinary functions
x+y!: Public ordinary functions
x-y: Public ordinary functions
x-y!: Public ordinary functions

Y
yule-walker-algorithm-given-acvs: Public ordinary functions
yule-walker-algorithm-given-data: Public ordinary functions

Z
zero-strict-lower-diagonal!: Public ordinary functions
zeros-of-polynomial: Public ordinary functions
zeros-of-polynomial-with-initial-estimates: Private ordinary functions


A.3 Variables

Jump to:   *   +  
C   S  
Index Entry  Section

*
*abscissas-32-point*: Private special variables
*sapa-cached-pre-fft-arrays*: Private special variables
*weights-32-point*: Private special variables

+
+coefficents-for-log-of-gamma+: Private special variables
+euler-constant+: Private constants
+log-pi+: Private constants
+nr-gser-eps+: Private special variables
+nr-gser-itmax+: Private special variables
+ppchi2-aa+: Private constants
+ppchi2-c1+: Private constants
+ppchi2-c10+: Private constants
+ppchi2-c11+: Private constants
+ppchi2-c12+: Private constants
+ppchi2-c13+: Private constants
+ppchi2-c14+: Private constants
+ppchi2-c15+: Private constants
+ppchi2-c16+: Private constants
+ppchi2-c17+: Private constants
+ppchi2-c18+: Private constants
+ppchi2-c19+: Private constants
+ppchi2-c2+: Private constants
+ppchi2-c20+: Private constants
+ppchi2-c21+: Private constants
+ppchi2-c22+: Private constants
+ppchi2-c23+: Private constants
+ppchi2-c24+: Private constants
+ppchi2-c25+: Private constants
+ppchi2-c26+: Private constants
+ppchi2-c27+: Private constants
+ppchi2-c28+: Private constants
+ppchi2-c29+: Private constants
+ppchi2-c3+: Private constants
+ppchi2-c30+: Private constants
+ppchi2-c31+: Private constants
+ppchi2-c32+: Private constants
+ppchi2-c33+: Private constants
+ppchi2-c34+: Private constants
+ppchi2-c35+: Private constants
+ppchi2-c36+: Private constants
+ppchi2-c37+: Private constants
+ppchi2-c38+: Private constants
+ppchi2-c4+: Private constants
+ppchi2-c5+: Private constants
+ppchi2-c6+: Private constants
+ppchi2-c7+: Private constants
+ppchi2-c8+: Private constants
+ppchi2-c9+: Private constants
+ppchi2-e+: Private constants
+ppchi2-pmax+: Private constants
+ppchi2-pmin+: Private constants
+ppnd-a0+: Private constants
+ppnd-a1+: Private constants
+ppnd-a2+: Private constants
+ppnd-a3+: Private constants
+ppnd-b1+: Private constants
+ppnd-b2+: Private constants
+ppnd-b3+: Private constants
+ppnd-b4+: Private constants
+ppnd-c0+: Private constants
+ppnd-c1+: Private constants
+ppnd-c2+: Private constants
+ppnd-c3+: Private constants
+ppnd-d1+: Private constants
+ppnd-d2+: Private constants
+sapa-10-over-log-10+: Private constants
+sapa-2-pi+: Private constants
+sapa-4-time-exp-of-1-over-4+: Private constants
+sapa-4-time-exp-of-minus-1-point-35+: Private constants
+sapa-minus-2-pi+: Private constants
+sapa-sqrt-8-over-e+: Private constants
+sqrt-of-two-pi+: Private constants
+use-pre-fft-with-cache-p+: Private special variables

C
Constant, +euler-constant+: Private constants
Constant, +log-pi+: Private constants
Constant, +ppchi2-aa+: Private constants
Constant, +ppchi2-c1+: Private constants
Constant, +ppchi2-c10+: Private constants
Constant, +ppchi2-c11+: Private constants
Constant, +ppchi2-c12+: Private constants
Constant, +ppchi2-c13+: Private constants
Constant, +ppchi2-c14+: Private constants
Constant, +ppchi2-c15+: Private constants
Constant, +ppchi2-c16+: Private constants
Constant, +ppchi2-c17+: Private constants
Constant, +ppchi2-c18+: Private constants
Constant, +ppchi2-c19+: Private constants
Constant, +ppchi2-c2+: Private constants
Constant, +ppchi2-c20+: Private constants
Constant, +ppchi2-c21+: Private constants
Constant, +ppchi2-c22+: Private constants
Constant, +ppchi2-c23+: Private constants
Constant, +ppchi2-c24+: Private constants
Constant, +ppchi2-c25+: Private constants
Constant, +ppchi2-c26+: Private constants
Constant, +ppchi2-c27+: Private constants
Constant, +ppchi2-c28+: Private constants
Constant, +ppchi2-c29+: Private constants
Constant, +ppchi2-c3+: Private constants
Constant, +ppchi2-c30+: Private constants
Constant, +ppchi2-c31+: Private constants
Constant, +ppchi2-c32+: Private constants
Constant, +ppchi2-c33+: Private constants
Constant, +ppchi2-c34+: Private constants
Constant, +ppchi2-c35+: Private constants
Constant, +ppchi2-c36+: Private constants
Constant, +ppchi2-c37+: Private constants
Constant, +ppchi2-c38+: Private constants
Constant, +ppchi2-c4+: Private constants
Constant, +ppchi2-c5+: Private constants
Constant, +ppchi2-c6+: Private constants
Constant, +ppchi2-c7+: Private constants
Constant, +ppchi2-c8+: Private constants
Constant, +ppchi2-c9+: Private constants
Constant, +ppchi2-e+: Private constants
Constant, +ppchi2-pmax+: Private constants
Constant, +ppchi2-pmin+: Private constants
Constant, +ppnd-a0+: Private constants
Constant, +ppnd-a1+: Private constants
Constant, +ppnd-a2+: Private constants
Constant, +ppnd-a3+: Private constants
Constant, +ppnd-b1+: Private constants
Constant, +ppnd-b2+: Private constants
Constant, +ppnd-b3+: Private constants
Constant, +ppnd-b4+: Private constants
Constant, +ppnd-c0+: Private constants
Constant, +ppnd-c1+: Private constants
Constant, +ppnd-c2+: Private constants
Constant, +ppnd-c3+: Private constants
Constant, +ppnd-d1+: Private constants
Constant, +ppnd-d2+: Private constants
Constant, +sapa-10-over-log-10+: Private constants
Constant, +sapa-2-pi+: Private constants
Constant, +sapa-4-time-exp-of-1-over-4+: Private constants
Constant, +sapa-4-time-exp-of-minus-1-point-35+: Private constants
Constant, +sapa-minus-2-pi+: Private constants
Constant, +sapa-sqrt-8-over-e+: Private constants
Constant, +sqrt-of-two-pi+: Private constants

S
Special Variable, *abscissas-32-point*: Private special variables
Special Variable, *sapa-cached-pre-fft-arrays*: Private special variables
Special Variable, *weights-32-point*: Private special variables
Special Variable, +coefficents-for-log-of-gamma+: Private special variables
Special Variable, +nr-gser-eps+: Private special variables
Special Variable, +nr-gser-itmax+: Private special variables
Special Variable, +use-pre-fft-with-cache-p+: Private special variables


A.4 Data types

Jump to:   A   B   D   F   H   M   N   P   R   S   T   U  
Index Entry  Section

A
acvs.lisp: The sapaclisp/acvs․lisp file

B
basic-math.lisp: The sapaclisp/basic-math․lisp file
basic-statistics.lisp: The sapaclisp/basic-statistics․lisp file

D
dft-and-fft.lisp: The sapaclisp/dft-and-fft․lisp file

F
File, acvs.lisp: The sapaclisp/acvs․lisp file
File, basic-math.lisp: The sapaclisp/basic-math․lisp file
File, basic-statistics.lisp: The sapaclisp/basic-statistics․lisp file
File, dft-and-fft.lisp: The sapaclisp/dft-and-fft․lisp file
File, filtering.lisp: The sapaclisp/filtering․lisp file
File, hacks.lisp: The sapaclisp/hacks․lisp file
File, harmonic.lisp: The sapaclisp/harmonic․lisp file
File, matrix.lisp: The sapaclisp/matrix․lisp file
File, multitaper.lisp: The sapaclisp/multitaper․lisp file
File, nonparametric.lisp: The sapaclisp/nonparametric․lisp file
File, parametric.lisp: The sapaclisp/parametric․lisp file
File, random.lisp: The sapaclisp/random․lisp file
File, sapa-package.lisp: The sapaclisp/sapa-package․lisp file
File, sapaclisp.asd: The sapaclisp/sapaclisp․asd file
File, tapers.lisp: The sapaclisp/tapers․lisp file
File, utilities.lisp: The sapaclisp/utilities․lisp file
filtering.lisp: The sapaclisp/filtering․lisp file

H
hacks.lisp: The sapaclisp/hacks․lisp file
harmonic.lisp: The sapaclisp/harmonic․lisp file

M
matrix.lisp: The sapaclisp/matrix․lisp file
multitaper.lisp: The sapaclisp/multitaper․lisp file

N
nonparametric.lisp: The sapaclisp/nonparametric․lisp file

P
Package, sapa: The sapa package
Package, sapaclisp-asd: The sapaclisp-asd package
parametric.lisp: The sapaclisp/parametric․lisp file

R
random.lisp: The sapaclisp/random․lisp file

S
sapa: The sapa package
sapa-package.lisp: The sapaclisp/sapa-package․lisp file
sapaclisp: The sapaclisp system
sapaclisp-asd: The sapaclisp-asd package
sapaclisp.asd: The sapaclisp/sapaclisp․asd file
System, sapaclisp: The sapaclisp system

T
tapers.lisp: The sapaclisp/tapers․lisp file

U
utilities.lisp: The sapaclisp/utilities․lisp file