3 ;;; Time-stamp: <2008-11-16 20:38:56 tony>
4 ;;; Creation: <2008-03-11 19:18:34 user>
5 ;;; File: packages.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2007--2008, AJ Rossini. BSD, LLGPL, or GPLv2, depending
9 ;;; Purpose: package structure description for lispstat
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
15 ;;; This organization and structure is new to the 21st Century
24 (defpackage :lisp-stat-object-system
25 (:nicknames
:ls-objects
:lsos
)
27 (:shadow
:call-method
:call-next-method
:slot-value
)
28 (:export ls-object objectp
*object
* kind-of-p make-object
30 *set-slot-hook
* slot-value self
31 send call-next-method call-method
32 defmeth defproto instance-slots proto-name
))
38 (defpackage :lisp-stat-types
39 (:documentation
"Provides some typeing for LispStat, but is clearly
43 check-nonneg-fixnum check-one-nonneg-fixnum
44 check-one-fixnum check-one-real check-one-number
))
51 (defpackage :lisp-stat-float
53 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
54 machine-epsilon base-float makedouble
56 make-base-trans-fun-2 make-base-trans-fun
58 base-log base-exp base-expt base-sqrt base-sin base-cos
59 base-tan base-asin base-acos base-atan base-sinh
60 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
61 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
62 BASE-FROUND BASE-SIGNUM BASE-CIS
))
65 (defpackage :lisp-stat-compound-data
67 :lisp-stat-object-system
69 (:shadowing-import-from
:lisp-stat-object-system
71 call-next-method call-method
)
72 (:export compound-data-p
*compound-data-proto
*
74 compound-data-seq compound-data-length
75 element-list element-seq
77 recursive-map-elements map-elements repeat
79 get-next-element make-next-element set-next-element
82 select split-list which
86 (defpackage :lisp-stat-macros
88 :lisp-stat-compound-data
)
89 (:export make-rv-function make-rv-function-1
))
91 (defpackage :lisp-stat-basics
93 :lisp-stat-object-system
97 :lisp-stat-compound-data
)
98 (:shadowing-import-from
:lisp-stat-object-system
99 slot-value call-method call-next-method
)
100 (:export permute-array sum prod count-elements mean
105 (defpackage :lisp-stat-float
107 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
108 machine-epsilon base-float makedouble
110 make-base-trans-fun-2 make-base-trans-fun
112 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
113 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
114 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
115 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
116 BASE-FROUND BASE-SIGNUM BASE-CIS
))
120 (defpackage :lisp-stat-macros
122 :lisp-stat-compound-data
)
123 (:export make-rv-function make-rv-function-1
))
125 ;;; NEW CLOS STRUCTURE
127 (defpackage :lisp-stat-data-clos
130 (:export get-variable-matrix get-variable-vector
131 ;; generic container class for data -- if small enough
132 ;; could be value, otherwise might be reference.
135 (defpackage :lisp-stat-regression-linear-clos
138 :lisp-stat-data-clos
)
139 (:export regression-model
))
145 (defpackage :lisp-stat-ffi-int
148 (:export ccl-store-integer ccl-store-double ccl-store-ptr
151 (defpackage :lisp-stat-probability
156 (:export log-gamma set-seed
158 normal-cdf normal-quant normal-dens normal-rand
160 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
161 gamma-cdf gamma-quant gamma-dens gamma-rand
162 chisq-cdf chisq-quant chisq-dens chisq-rand
163 beta-cdf beta-quant beta-dens beta-rand
164 t-cdf t-quant t-dens t-rand
165 f-cdf f-quant f-dens f-rand
166 poisson-cdf poisson-quant poisson-pmf poisson-rand
167 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
171 (defpackage :lisp-stat-matrix
174 :lisp-stat-compound-data
)
175 (:export matrixp
;; matrix -- conflicts!
176 num-rows num-cols matmult identity-matrix diagonal
177 row-list column-list inner-product outer-product
178 cross-product transpose bind-columns bind-rows
179 array-data-vector vector-to-array
181 check-matrix check-square-matrix
183 copy-array copy-vector
186 (defpackage :lisp-stat-linalg-data
191 :lisp-stat-compound-data
193 (:export
;; more to add
194 +mode-in
+ +mode-re
+ +mode-cx
+ mode-of
196 la-data-mode la-allocate la-free
198 la-get-double la-put-double
201 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
202 la-vector la-free-vector la-vector-to-data la-data-to-vector
))
205 (defpackage :lisp-stat-math
207 :lisp-stat-object-system
209 :lisp-stat-compound-data
211 (:shadowing-import-from
:lisp-stat-object-system
212 slot-value call-method call-next-method
)
213 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
214 asin acos atan sinh cosh tanh asinh acosh atanh float random
215 truncate floor ceiling round minusp zerop plusp evenp oddp
216 < <= = /= >= > ;; complex
217 conjugate realpart imagpart phase
218 min max logand logior logxor lognot ffloor fceiling
219 ftruncate fround signum cis
)
220 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
221 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
222 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
224 conjugate realpart imagpart phase min max
225 logand logior logxor lognot ffloor fceiling ftruncate fround
227 (:documentation
"Vectorization of numerical functions"))
230 (defpackage :lisp-stat-linalg
237 :lisp-stat-compound-data
238 :lisp-stat-linalg-data
240 (:shadowing-import-from
:lisp-stat-math
241 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
242 asin acos atan sinh cosh tanh asinh acosh atanh float random
243 truncate floor ceiling round minusp zerop plusp evenp oddp
244 < <= = /= >= > complex conjugate realpart imagpart phase
245 min max logand logior logxor lognot ffloor fceiling
246 ftruncate fround signum cis
)
247 (:export chol-decomp lu-decomp lu-solve determinant inverse
248 sv-decomp qr-decomp rcondest make-rotation spline
249 kernel-dens kernel-smooth
250 fft make-sweep-matrix sweep-operator ax
+y eigen
252 check-real
;; for optimize
254 covariance-matrix matrix print-matrix solve
255 backsolve eigenvalues eigenvectors accumulate cumsum combine
261 (defpackage :lisp-stat-data
262 (:documentation
"Data management, integration, I/O, and other data technologies.")
263 (:nicknames
:ls-data
)
265 :lisp-stat-object-system
268 :lisp-stat-compound-data
)
269 (:shadowing-import-from
:lisp-stat-object-system
270 slot-value call-method call-next-method
)
271 (:export open-file-dialog read-data-file read-data-columns load-data
272 load-example
*variables
* *ask-on-redefine
*
273 def variables savevar undef
))
275 (defpackage :lisp-stat-descriptive-statistics
279 :lisp-stat-compound-data
281 :lisp-stat-linalg-data
284 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
285 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
286 asin acos atan sinh cosh tanh asinh acosh atanh float random
287 truncate floor ceiling round minusp zerop plusp evenp oddp
288 < <= = /= >= > ;; complex
289 conjugate realpart imagpart phase
290 min max logand logior logxor lognot ffloor fceiling
291 ftruncate fround signum cis
)
292 (:export standard-deviation quantile median interquartile-range
296 (defpackage :lisp-stat-regression-linear
298 :lisp-stat-object-system
300 :lisp-stat-compound-data
304 :lisp-stat-descriptive-statistics
)
305 (:shadowing-import-from
:lisp-stat-object-system
306 slot-value call-method call-next-method
)
307 (:shadowing-import-from
:lisp-stat-math
308 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
309 asin acos atan sinh cosh tanh asinh acosh atanh float random
310 truncate floor ceiling round minusp zerop plusp evenp oddp
311 < <= = /= >= > ;; complex
312 conjugate realpart imagpart phase
313 min max logand logior logxor lognot ffloor fceiling
314 ftruncate fround signum cis
)
315 (:export regression-model regression-model-proto x y intercept sweep-matrix
316 basis weights included total-sum-of-squares residual-sum-of-squares
317 predictor-names response-name case-labels
))
319 (defpackage :lisp-stat
320 (:documentation
"Experimentation package for LispStat. Serious
321 work should be packaged up elsewhere for reproducibility. By this
322 I mean, creating a data/analytics/analysis package with the
323 minimal set of objects required.")
325 :lisp-stat-object-system
326 :lisp-stat-compound-data
327 :lisp-stat-probability
335 :lisp-stat-descriptive-statistics
336 :lisp-stat-regression-linear
)
337 (:shadowing-import-from
:lisp-stat-object-system
338 slot-value call-method call-next-method
)
339 (:shadowing-import-from
:lisp-stat-math
340 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
341 asin acos atan sinh cosh tanh asinh acosh atanh float random
342 truncate floor ceiling round minusp zerop plusp evenp oddp
343 < <= = /= >= > ;;complex
344 conjugate realpart imagpart phase
345 min max logand logior logxor lognot ffloor fceiling
346 ftruncate fround signum cis
)
353 fixnump check-nonneg-fixnum check-one-fixnum
354 check-one-real check-one-number
362 compound-data-p
*compound-data-proto
* compound-object-p
363 compound-data-seq compound-data-length
364 element-list element-seq
366 recursive-map-elements map-elements
369 get-next-element make-next-element set-next-element
377 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
378 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
379 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
381 conjugate realpart imagpart phase min max
382 logand logior logxor lognot ffloor fceiling ftruncate fround
386 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
387 column-list inner-product outer-product cross-product transpose
388 bind-columns bind-rows
391 chol-decomp lu-decomp lu-solve determinant inverse
392 sv-decomp qr-decomp rcondest make-rotation spline
393 kernel-dens kernel-smooth
394 fft make-sweep-matrix sweep-operator ax
+y eigen
396 covariance-matrix matrix print-matrix solve
397 backsolve eigenvalues eigenvectors accumulate cumsum combine
400 ;; in linalg.lisp, possibly not supported by matlisp
401 spline kernel-dens kernel-smooth
407 make-rv-function make-rv-function-1
410 open-file-dialog read-data-file read-data-columns load-data
411 load-example
*variables
* *ask-on-redefine
*
412 def variables savevar undef
415 standard-deviation quantile median interquartile-range
420 uniform-rand normal-cdf normal-quant normal-dens
421 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
422 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
423 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
424 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
425 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
426 binomial-cdf binomial-quant binomial-pmf binomial-rand
428 ;;; Here is where we have a problem -- lispstat core should be core
429 ;;; data management and config problems, with packages providing
430 ;;; specialized extensions to LispStat, i.e. regression, nonlin
431 ;;; regression, bayesian regression via laplace approximation, etc.
433 ;;; The following could be considered "recommended packages", similar
434 ;;; to the idea of the recommended packages in R.
437 regression-model regression-model-proto x y intercept sweep-matrix
438 basis weights included total-sum-of-squares residual-sum-of-squares
439 predictor-names response-name case-labels
442 nreg-model nreg-model-proto mean-function theta-hat epsilon
446 bayes-model bayes-model-proto bayes-internals
))
449 ;;;; PACKAGES FOR USEABILITY
451 (defpackage :lisp-stat-data-examples
452 (:documentation
"Example data for unittests, examples, illustrations,")
455 (:shadowing-import-from
:lisp-stat
456 slot-value call-method call-next-method
458 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
459 asin acos atan sinh cosh tanh asinh acosh atanh float random
460 truncate floor ceiling round minusp zerop plusp evenp oddp
461 < <= = /= >= > > ;; complex
462 conjugate realpart imagpart phase
463 min max logand logior logxor lognot ffloor fceiling
464 ftruncate fround signum cis
467 (:export iron aluminum absorbtion
471 (defpackage :lisp-stat-user
472 (:documentation
"Experimentation package for LispStat.
473 Serious work should be placed in a similar package elsewhere for
474 reproducibility. But this should hint as to what needs to be
475 done for a user- or analysis-package.")
476 (:nicknames
:ls-user
)
479 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
480 (:shadowing-import-from
:lisp-stat
481 slot-value call-method call-next-method
483 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
484 asin acos atan sinh cosh tanh asinh acosh atanh float random
485 truncate floor ceiling round minusp zerop plusp evenp oddp
486 < <= = /= >= > > ;; complex
487 conjugate realpart imagpart phase
488 min max logand logior logxor lognot ffloor fceiling
489 ftruncate fround signum cis
493 (defpackage :lisp-stat-unittests
494 (:use
:common-lisp
:lift
:lisp-stat
:lisp-stat-data-examples
)
495 (:shadowing-import-from
:lisp-stat
496 slot-value call-method call-next-method
;; objects
497 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
498 asin acos atan sinh cosh tanh asinh acosh atanh float random
499 truncate floor ceiling round minusp zerop plusp evenp oddp
500 < <= = /= >= > ;; complex
501 conjugate realpart imagpart phase
502 min max logand logior logxor lognot ffloor fceiling
503 ftruncate fround signum cis
)
504 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
505 almost
= almost
=lists numerical
=)) ; compare
507 (defpackage :lisp-stat-data-clos-example
509 :lift
:lisp-stat-unittests
510 :lisp-stat-data-examples
511 :lisp-stat-data-clos
)
512 (:export absorbtion aluminum iron
))