3 ;;; Time-stamp: <2008-12-03 07:49:59 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.
136 (defpackage :lisp-stat-regression-linear-clos
139 :lisp-stat-data-clos
)
140 (:export regression-model
))
146 (defpackage :lisp-stat-ffi-int
149 (:export ccl-store-integer ccl-store-double ccl-store-ptr
152 (defpackage :lisp-stat-probability
157 (:export log-gamma set-seed
159 normal-cdf normal-quant normal-dens normal-rand
161 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
162 gamma-cdf gamma-quant gamma-dens gamma-rand
163 chisq-cdf chisq-quant chisq-dens chisq-rand
164 beta-cdf beta-quant beta-dens beta-rand
165 t-cdf t-quant t-dens t-rand
166 f-cdf f-quant f-dens f-rand
167 poisson-cdf poisson-quant poisson-pmf poisson-rand
168 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
172 (defpackage :lisp-stat-matrix
175 :lisp-stat-compound-data
)
176 (:export matrixp
;; matrix -- conflicts!
177 num-rows num-cols matmult identity-matrix diagonal
178 row-list column-list inner-product outer-product
179 cross-product transpose bind-columns bind-rows
180 array-data-vector vector-to-array
182 check-matrix check-square-matrix
184 copy-array copy-vector
187 (defpackage :lisp-stat-linalg-data
192 :lisp-stat-compound-data
194 (:export
;; more to add
195 +mode-in
+ +mode-re
+ +mode-cx
+ mode-of
197 la-data-mode la-allocate la-free
199 la-get-double la-put-double
202 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
203 la-vector la-free-vector la-vector-to-data la-data-to-vector
))
206 (defpackage :lisp-stat-math
208 :lisp-stat-object-system
210 :lisp-stat-compound-data
212 (:shadowing-import-from
:lisp-stat-object-system
213 slot-value call-method call-next-method
)
214 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
215 asin acos atan sinh cosh tanh asinh acosh atanh float random
216 truncate floor ceiling round minusp zerop plusp evenp oddp
217 < <= = /= >= > ;; complex
218 conjugate realpart imagpart phase
219 min max logand logior logxor lognot ffloor fceiling
220 ftruncate fround signum cis
)
221 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
222 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
223 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
225 conjugate realpart imagpart phase min max
226 logand logior logxor lognot ffloor fceiling ftruncate fround
228 (:documentation
"Vectorization of numerical functions"))
231 (defpackage :lisp-stat-linalg
238 :lisp-stat-compound-data
239 :lisp-stat-linalg-data
241 (:shadowing-import-from
:lisp-stat-math
242 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
243 asin acos atan sinh cosh tanh asinh acosh atanh float random
244 truncate floor ceiling round minusp zerop plusp evenp oddp
245 < <= = /= >= > complex conjugate realpart imagpart phase
246 min max logand logior logxor lognot ffloor fceiling
247 ftruncate fround signum cis
)
248 (:export chol-decomp lu-decomp lu-solve determinant inverse
249 sv-decomp qr-decomp rcondest make-rotation spline
250 kernel-dens kernel-smooth
251 fft make-sweep-matrix sweep-operator ax
+y eigen
253 check-real
;; for optimize
255 covariance-matrix matrix print-matrix solve
256 backsolve eigenvalues eigenvectors accumulate cumsum combine
262 (defpackage :lisp-stat-data
263 (:documentation
"Data management, integration, I/O, and other data technologies.")
264 (:nicknames
:ls-data
)
266 :lisp-stat-object-system
269 :lisp-stat-compound-data
)
270 (:shadowing-import-from
:lisp-stat-object-system
271 slot-value call-method call-next-method
)
272 (:export open-file-dialog read-data-file read-data-columns load-data
273 load-example
*variables
* *ask-on-redefine
*
274 def variables savevar undef
))
276 (defpackage :lisp-stat-descriptive-statistics
280 :lisp-stat-compound-data
283 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
284 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
285 asin acos atan sinh cosh tanh asinh acosh atanh float random
286 truncate floor ceiling round minusp zerop plusp evenp oddp
287 < <= = /= >= > ;; complex
288 conjugate realpart imagpart phase
289 min max logand logior logxor lognot ffloor fceiling
290 ftruncate fround signum cis
)
291 (:export standard-deviation quantile median interquartile-range
295 (defpackage :lisp-stat-regression-linear
297 :lisp-stat-object-system
299 :lisp-stat-compound-data
302 :lisp-stat-descriptive-statistics
)
303 (:shadowing-import-from
:lisp-stat-object-system
304 slot-value call-method call-next-method
)
305 (:shadowing-import-from
:lisp-stat-math
306 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
307 asin acos atan sinh cosh tanh asinh acosh atanh float random
308 truncate floor ceiling round minusp zerop plusp evenp oddp
309 < <= = /= >= > ;; complex
310 conjugate realpart imagpart phase
311 min max logand logior logxor lognot ffloor fceiling
312 ftruncate fround signum cis
)
313 (:export regression-model regression-model-proto x y intercept sweep-matrix
314 basis weights included total-sum-of-squares residual-sum-of-squares
315 predictor-names response-name case-labels
))
317 (defpackage :lisp-stat
318 (:documentation
"Experimentation package for LispStat. Serious
319 work should be packaged up elsewhere for reproducibility. By this
320 I mean, creating a data/analytics/analysis package with the
321 minimal set of objects required.")
323 :lisp-stat-object-system
324 :lisp-stat-compound-data
325 :lisp-stat-probability
331 :lisp-matrix
;; conversion to a more robust linalg approach
332 :lisp-stat-descriptive-statistics
333 :lisp-stat-regression-linear
)
334 (:shadowing-import-from
:lisp-stat-object-system
335 slot-value call-method call-next-method
)
336 (:shadowing-import-from
:lisp-stat-math
337 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
338 asin acos atan sinh cosh tanh asinh acosh atanh float random
339 truncate floor ceiling round minusp zerop plusp evenp oddp
342 conjugate realpart imagpart phase
345 logand logior logxor lognot
346 ffloor fceiling ftruncate fround
354 fixnump check-nonneg-fixnum check-one-fixnum
355 check-one-real check-one-number
363 compound-data-p
*compound-data-proto
* compound-object-p
364 compound-data-seq compound-data-length
365 element-list element-seq
367 recursive-map-elements map-elements
370 get-next-element make-next-element set-next-element
378 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
379 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
380 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
382 conjugate realpart imagpart phase min max
383 logand logior logxor lognot ffloor fceiling ftruncate fround
387 ;; The following need to be re-found in lisp-matrix...
389 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
390 column-list inner-product outer-product cross-product transpose
391 bind-columns bind-rows
394 chol-decomp lu-decomp lu-solve determinant inverse
395 sv-decomp qr-decomp rcondest make-rotation spline
396 kernel-dens kernel-smooth
397 fft make-sweep-matrix sweep-operator ax
+y eigen
399 covariance-matrix matrix print-matrix solve
400 backsolve eigenvalues eigenvectors accumulate cumsum combine
403 ;; in linalg.lisp, possibly not supported by matlisp
404 spline kernel-dens kernel-smooth
412 make-rv-function make-rv-function-1
415 open-file-dialog read-data-file read-data-columns load-data
416 load-example
*variables
* *ask-on-redefine
*
417 def variables savevar undef
419 ;; statistics.lsp (descriptions, should probably be moved
421 standard-deviation quantile median interquartile-range
424 ;; probability (dists.lisp)
426 uniform-rand normal-cdf normal-quant normal-dens
427 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
428 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
429 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
430 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
431 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
432 binomial-cdf binomial-quant binomial-pmf binomial-rand
434 ;; Here is where we have a problem -- lispstat core should be core
435 ;; data management and config problems, with packages providing
436 ;; specialized extensions to LispStat, i.e. regression, nonlin
437 ;; regression, bayesian regression via laplace approximation, etc.
439 ;; The following could be considered "recommended packages",
440 ;; similar to the idea of the recommended packages in R. Probably
441 ;; we want them to do the exporting within that package, therefore
442 ;; NOT being able to lock the "data-ish" package, but only the
443 ;; subpackages prior to export.
446 regression-model regression-model-proto x y intercept sweep-matrix
447 basis weights included total-sum-of-squares residual-sum-of-squares
448 predictor-names response-name case-labels
451 nreg-model nreg-model-proto mean-function theta-hat epsilon
455 bayes-model bayes-model-proto bayes-internals
))
458 ;;;; PACKAGES FOR USEABILITY
460 (defpackage :lisp-stat-data-examples
461 (:documentation
"Example data for unittests, examples, illustrations,")
464 (:shadowing-import-from
:lisp-stat
465 slot-value call-method call-next-method
467 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
468 asin acos atan sinh cosh tanh asinh acosh atanh float random
469 truncate floor ceiling round minusp zerop plusp evenp oddp
470 < <= = /= >= > > ;; complex
471 conjugate realpart imagpart phase
472 min max logand logior logxor lognot ffloor fceiling
473 ftruncate fround signum cis
476 (:export iron aluminum absorbtion
480 (defpackage :lisp-stat-user
481 (:documentation
"Experimentation package for LispStat.
482 Serious work should be placed in a similar package elsewhere for
483 reproducibility. But this should hint as to what needs to be
484 done for a user- or analysis-package.")
485 (:nicknames
:ls-user
)
489 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
490 (:shadowing-import-from
:lisp-stat
491 slot-value call-method call-next-method
493 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
494 asin acos atan sinh cosh tanh asinh acosh atanh float random
495 truncate floor ceiling round minusp zerop plusp evenp oddp
496 < <= = /= >= > > ;; complex
497 conjugate realpart imagpart phase
498 min max logand logior logxor lognot ffloor fceiling
499 ftruncate fround signum cis
503 (defpackage :lisp-stat-unittests
504 (:use
:common-lisp
:lift
:lisp-stat
:lisp-stat-data-examples
)
505 (:shadowing-import-from
:lisp-stat
506 slot-value call-method call-next-method
;; objects
507 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
508 asin acos atan sinh cosh tanh asinh acosh atanh float random
509 truncate floor ceiling round minusp zerop plusp evenp oddp
510 < <= = /= >= > ;; complex
511 conjugate realpart imagpart phase
512 min max logand logior logxor lognot ffloor fceiling
513 ftruncate fround signum cis
)
514 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
515 almost
= almost
=lists numerical
=)) ; compare
517 (defpackage :lisp-stat-data-clos-example
519 :lift
:lisp-stat-unittests
520 :lisp-stat-data-examples
521 :lisp-stat-data-clos
)
522 (:export absorbtion aluminum iron
))