The LISP-STAT Reference Manual

The LISP-STAT Reference Manual

This is the LISP-STAT Reference Manual, version 1.2.0, generated automatically by Declt version 4.0b2.

Copyright © 2019-2022 Steve Nunez

Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.

Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the section entitled “Copying” is included exactly as in the original.

Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be translated as well.

Table of Contents


Copying

This program is distributed under the terms of the Microsoft Public License.


1 Systems

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


1.1 lisp-stat

A statistical computing environment for Common Lisp

Long Name

Statistical Computing in Common Lisp

Author

Steve Nunez <steve@symbolics.tech>

Home Page

https://lisp-stat.dev/

Source Control

(GIT https://github.com/Lisp-Stat/lisp-stat.git)

Bug Tracker

https://github.com/Lisp-Stat/lisp-stat/issues

License

MS-PL

Long Description

The Lisp-Stat system is an umbrella for a few projects and provides a unified interface for working with statistics. The general rule is that Lisp-Stat may depend on other libraries, for example data-frame, but not the other way around. Lisp-Stat provides it’s own user package, LS-USER, which imports CL as well as the symbols we need from the other libraries. You should always do your work in the LS-USER package, and not in CL-USER.

Version

1.2.0

Dependencies
  • alexandria (system).
  • alexandria+ (system).
  • array-operations (system).
  • data-frame (system).
  • distributions (system).
  • dexador (system).
  • dfio (system).
  • num-utils (system).
  • select (system).
  • statistics (system).
  • org.tfeb.conduit-packages (system).
Source

lisp-stat.asd.

Child Components

2 Modules

Modules are listed depth-first from the system components tree.


2.1 lisp-stat/base

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).

Child Component

variables.lisp (file).


2.2 lisp-stat/docs

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).

Child Component

doc-strings.lisp (file).


3 Files

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


3.1 Lisp


3.1.1 lisp-stat/lisp-stat.asd

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).

ASDF Systems

lisp-stat.


3.1.2 lisp-stat/pkgdcls.lisp

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).

Packages

3.1.3 lisp-stat/base/variables.lisp

Source

lisp-stat.asd.

Parent Component

base (module).

Public Interface
Internals

3.1.4 lisp-stat/docs/doc-strings.lisp

Source

lisp-stat.asd.

Parent Component

docs (module).


3.1.5 lisp-stat/ls-init.lisp

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).

Internals

setup-ls-translations (function).


3.2 Static


3.2.1 lisp-stat/license

Source

lisp-stat.asd.

Parent Component

lisp-stat (system).


4 Packages

Packages are listed by definition order.


4.1 lisp-stat

Source

pkgdcls.lisp.

Public Interface
Internals

4.2 ls-user

Source

pkgdcls.lisp.

Internals

5 Definitions

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


5.1 Public Interface


5.1.1 Macros

Macro: def (name value &optional documentation)

Define a data variable
VALUE is not evaluated and must be a symbol. Assigns the value of FORM to VALUE and adds VALUE to the list *VARIABLES* of def’ed variables. Returns VALUE. If VALUE is already bound and the global variable *ASK-ON-REDEFINE* is not nil then you are asked if you want to redefine the variable.

Package

lisp-stat.

Source

variables.lisp.


5.1.2 Ordinary functions

Function: savevar (vars file &optional suffix)

VARS is a symbol or a list of symbols. FILE is a string (or a symbol whose print name is used) not ending in SUFFIX (defaults to ".lisp"). The VARS and their current values are written to the file FILE.lisp in a form suitable for use with the load command. NOTE: Ensure VARS doesn’t contain CLOS objects that don’t have a SAVE-OBJ method. Example (savevar ’urban "urban")

Package

lisp-stat.

Source

variables.lisp.

Function: undef-var (v)

Remove V from the system
If V is the symbol of a defined variable the variable it is unbound and removed from the list of defined variables. If V is a list of variable names each is unbound and removed. Returns V. Example: (undef ’urban)

Package

lisp-stat.

Source

variables.lisp.

Function: variables ()

Returns a list of the names of all def’ed variables.

Package

lisp-stat.

Source

variables.lisp.


5.2 Internals


5.2.1 Special variables

Special Variable: *variables*
Package

lisp-stat.

Source

variables.lisp.

Special Variable: iris

Edgar Anderson’s Iris Data

Description
This famous (Fisher’s or Anderson’s) iris data set gives the measurements in centimeters of the variables sepal length and width and petal length and width, respectively, for 70 flowers from each of 3 species of iris. The species are Iris setosa, versicolor, and virginica.

Source
Fisher, R. A. (1937) The use of multiple measurements in taxonomic problems. Annals of Eugenics, 7, Part II, 179–188. The data were collected by Anderson, Edgar (1937). The irises of the Gaspe Peninsula, Bulletin of the American Iris Society, 79, 2–7

References
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) The New S Language. Wadsworth & Brooks/Cole. (has iris3 as iris.)

Examples (from R)

dni3 <- dimnames(iris3)
ii <- data.frame(matrix(aperm(iris3, c(1,3,2)), ncol = 4,
dimnames = list(NULL, sub(" L.",".Length", sub(" W.",".Width", dni3[[2]])))), Species = gl(3, 50, labels = sub("S", "s", sub("V", "v", dni3[[3]])))) all.equal(ii, iris) # TRUE

Package

ls-user.

Special Variable: mtcars

Motor Trend Car Road Tests

Description
The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models).

Note
Henderson and Velleman (1981) comment in a footnote to Table 1: ‘Hocking [original transcriber]’s noncrucial coding of the Mazda’s rotary engine as a straight six-cylinder engine and the Porsche’s flat engine as a V engine, as well as the inclusion of the diesel Mercedes 240D, have been retained to enable direct comparisons to be made with previous analyses.’

Source
Henderson and Velleman (1981), Building multiple regression models interactively. Biometrics, 37, 391–411.

Package

ls-user.

Special Variable: plant-growth

Results from an Experiment on Plant Growth

Description
Results from an experiment to compare yields (as measured by dried weight of plants) obtained under a control and two different treatment conditions.

Format
A data frame of 30 cases on 2 variables.
[, 1] weight numeric
[, 2] group factor

The levels of group are ‘ctrl’, ‘trt1’, and ‘trt2’.

Source
Dobson, A. J. (1983) An Introduction to Statistical Modelling. London: Chapman and Hall.

Examples (from R)

## One factor ANOVA example from Dobson’s book, cf. Table 7.4: require(stats); require(graphics)
boxplot(weight ~ group, data = PlantGrowth, main = "PlantGrowth data", ylab = "Dried weight of plants", col = "lightgray",
notch = TRUE, varwidth = TRUE)
anova(lm(weight ~ group, data = PlantGrowth))

Package

ls-user.

Special Variable: tooth-growth

The Effect of Vitamin C on Tooth Growth in Guinea Pigs

Description
The response is the length of odontoblasts (cells responsible for
tooth growth) in 60 guinea pigs. Each animal received one of three
dose levels of vitamin C (0.5, 1, and 2 mg/day) by one of two delivery methods, orange juice or ascorbic acid (a form of vitamin C and coded as VC).

Format
A data frame with 60 observations on 3 variables.
[,1] len numeric Tooth length
[,2] supp factor Supplement type (VC or OJ).
[,3] dose numeric Dose in milligrams/day

Source
C. I. Bliss (1952). The Statistics of Bioassay. Academic Press.

References
- McNeil, D. R. (1977). Interactive Data Analysis. New York: Wiley.
- Crampton, E. W. (1947). The growth of the odontoblast of the incisor teeth as a criterion of vitamin C intake of the guinea pig. The Journal of Nutrition, 33(5), 491–504. doi: 10.1093/jn/33.5.491.

Examples

require(graphics)
coplot(len ~ dose | supp, data = ToothGrowth, panel = panel.smooth, xlab = "ToothGrowth data: length vs dose, given type of supplement")

Package

ls-user.

Special Variable: usarrests

Violent Crime Rates by US State

Description
This data set contains statistics, in arrests per 100,000 residents,
for assault, murder, and rape in each of the 50 US states in 1973.
Also given is the percent of the population living in urban areas.

Note
USArrests contains the data as in McNeil’s monograph. For the UrbanPop percentages, a review of the table (No. 21) in the Statistical
Abstracts 1975 reveals a transcription error for Maryland (and that
McNeil used the same “round to even” rule that R’s round() uses), as
found by Daniel S Coven (Arizona).

See the example below on how to correct the error and improve accuracy
for the ‘<n>.5’ percentages.

Source
World Almanac and Book of facts 1975. (Crime rates).
Statistical Abstracts of the United States 1975, p.20, (Urban rates), possibly available as
https://books.google.ch/books?id=zl9qAAAAMAAJ&pg=PA20.

References
McNeil, D. R. (1977) Interactive Data Analysis. New York: Wiley.

Examples

(summary usarrests)

;; Difference between ’USArrests’ and its correction
(which usarrests:x3 :predicate (lambda (x) (string= "Maryland" x))) ; #(19) (select usarrests 19 ’urbanpop) ; 67, the value transcribed incorrectly (setf (elt usarrests:urbanpop 19) 76.6) ; change to the correct value

;; correct rounding errors of +/- 0.5 to restore the original <n>.5 percentages (map nil (lambda (x)
(setf (elt usarrests:urbanpop x)
(+ 0.5 (elt usarrests:urbanpop x))))
(which usarrests:x3 :predicate (lambda (x)
(or (string= "Colorado" x)
(string= "Florida" x)
(string= "Mississippi" x)
(string= "Wyoming" x)))))

(map nil (lambda (x)
(setf (elt usarrests:urbanpop x)
(- 0.5 (elt usarrests:urbanpop x))))
(which usarrests:x3 :predicate (lambda (x)
(or (string= "Nebraska" x)
(string= "Pennsylvania" x)))))

Package

ls-user.


5.2.2 Ordinary functions

Function: setup-ls-translations ()
Package

lisp-stat.

Source

ls-init.lisp.


5.2.3 Generic functions

Generic Function: save-obj (data)

Save data object

Package

lisp-stat.

Source

variables.lisp.


Appendix A Indexes


A.1 Concepts