3 ;;; Time-stamp: <2008-11-25 08:31:31 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
282 ;; redone within lisp-matrix -- will need to have a package for
285 :lisp-stat-linalg-data
289 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
290 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
291 asin acos atan sinh cosh tanh asinh acosh atanh float random
292 truncate floor ceiling round minusp zerop plusp evenp oddp
293 < <= = /= >= > ;; complex
294 conjugate realpart imagpart phase
295 min max logand logior logxor lognot ffloor fceiling
296 ftruncate fround signum cis
)
297 (:export standard-deviation quantile median interquartile-range
301 (defpackage :lisp-stat-regression-linear
303 :lisp-stat-object-system
305 :lisp-stat-compound-data
308 :lisp-stat-descriptive-statistics
)
309 (:shadowing-import-from
:lisp-stat-object-system
310 slot-value call-method call-next-method
)
311 (:shadowing-import-from
:lisp-stat-math
312 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
313 asin acos atan sinh cosh tanh asinh acosh atanh float random
314 truncate floor ceiling round minusp zerop plusp evenp oddp
315 < <= = /= >= > ;; complex
316 conjugate realpart imagpart phase
317 min max logand logior logxor lognot ffloor fceiling
318 ftruncate fround signum cis
)
319 (:export regression-model regression-model-proto x y intercept sweep-matrix
320 basis weights included total-sum-of-squares residual-sum-of-squares
321 predictor-names response-name case-labels
))
323 (defpackage :lisp-stat
324 (:documentation
"Experimentation package for LispStat. Serious
325 work should be packaged up elsewhere for reproducibility. By this
326 I mean, creating a data/analytics/analysis package with the
327 minimal set of objects required.")
329 :lisp-stat-object-system
330 :lisp-stat-compound-data
331 :lisp-stat-probability
337 :lisp-matrix
;; conversion to a more robust linalg approach
338 :lisp-stat-descriptive-statistics
339 :lisp-stat-regression-linear
)
340 (:shadowing-import-from
:lisp-stat-object-system
341 slot-value call-method call-next-method
)
342 (:shadowing-import-from
:lisp-stat-math
343 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
344 asin acos atan sinh cosh tanh asinh acosh atanh float random
345 truncate floor ceiling round minusp zerop plusp evenp oddp
348 conjugate realpart imagpart phase
351 logand logior logxor lognot
352 ffloor fceiling ftruncate fround
360 fixnump check-nonneg-fixnum check-one-fixnum
361 check-one-real check-one-number
369 compound-data-p
*compound-data-proto
* compound-object-p
370 compound-data-seq compound-data-length
371 element-list element-seq
373 recursive-map-elements map-elements
376 get-next-element make-next-element set-next-element
384 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
385 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
386 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
388 conjugate realpart imagpart phase min max
389 logand logior logxor lognot ffloor fceiling ftruncate fround
393 ;; The following need to be re-found in lisp-matrix...
395 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
396 column-list inner-product outer-product cross-product transpose
397 bind-columns bind-rows
400 chol-decomp lu-decomp lu-solve determinant inverse
401 sv-decomp qr-decomp rcondest make-rotation spline
402 kernel-dens kernel-smooth
403 fft make-sweep-matrix sweep-operator ax
+y eigen
405 covariance-matrix matrix print-matrix solve
406 backsolve eigenvalues eigenvectors accumulate cumsum combine
409 ;; in linalg.lisp, possibly not supported by matlisp
410 spline kernel-dens kernel-smooth
418 make-rv-function make-rv-function-1
421 open-file-dialog read-data-file read-data-columns load-data
422 load-example
*variables
* *ask-on-redefine
*
423 def variables savevar undef
425 ;; statistics.lsp (descriptions, should probably be moved
427 standard-deviation quantile median interquartile-range
430 ;; probability (dists.lisp)
432 uniform-rand normal-cdf normal-quant normal-dens
433 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
434 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
435 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
436 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
437 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
438 binomial-cdf binomial-quant binomial-pmf binomial-rand
440 ;; Here is where we have a problem -- lispstat core should be core
441 ;; data management and config problems, with packages providing
442 ;; specialized extensions to LispStat, i.e. regression, nonlin
443 ;; regression, bayesian regression via laplace approximation, etc.
445 ;; The following could be considered "recommended packages",
446 ;; similar to the idea of the recommended packages in R. Probably
447 ;; we want them to do the exporting within that package, therefore
448 ;; NOT being able to lock the "data-ish" package, but only the
449 ;; subpackages prior to export.
452 regression-model regression-model-proto x y intercept sweep-matrix
453 basis weights included total-sum-of-squares residual-sum-of-squares
454 predictor-names response-name case-labels
457 nreg-model nreg-model-proto mean-function theta-hat epsilon
461 bayes-model bayes-model-proto bayes-internals
))
464 ;;;; PACKAGES FOR USEABILITY
466 (defpackage :lisp-stat-data-examples
467 (:documentation
"Example data for unittests, examples, illustrations,")
470 (:shadowing-import-from
:lisp-stat
471 slot-value call-method call-next-method
473 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
474 asin acos atan sinh cosh tanh asinh acosh atanh float random
475 truncate floor ceiling round minusp zerop plusp evenp oddp
476 < <= = /= >= > > ;; complex
477 conjugate realpart imagpart phase
478 min max logand logior logxor lognot ffloor fceiling
479 ftruncate fround signum cis
482 (:export iron aluminum absorbtion
486 (defpackage :lisp-stat-user
487 (:documentation
"Experimentation package for LispStat.
488 Serious work should be placed in a similar package elsewhere for
489 reproducibility. But this should hint as to what needs to be
490 done for a user- or analysis-package.")
491 (:nicknames
:ls-user
)
495 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
496 (:shadowing-import-from
:lisp-stat
497 slot-value call-method call-next-method
499 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
500 asin acos atan sinh cosh tanh asinh acosh atanh float random
501 truncate floor ceiling round minusp zerop plusp evenp oddp
502 < <= = /= >= > > ;; complex
503 conjugate realpart imagpart phase
504 min max logand logior logxor lognot ffloor fceiling
505 ftruncate fround signum cis
509 (defpackage :lisp-stat-unittests
510 (:use
:common-lisp
:lift
:lisp-stat
:lisp-stat-data-examples
)
511 (:shadowing-import-from
:lisp-stat
512 slot-value call-method call-next-method
;; objects
513 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
514 asin acos atan sinh cosh tanh asinh acosh atanh float random
515 truncate floor ceiling round minusp zerop plusp evenp oddp
516 < <= = /= >= > ;; complex
517 conjugate realpart imagpart phase
518 min max logand logior logxor lognot ffloor fceiling
519 ftruncate fround signum cis
)
520 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
521 almost
= almost
=lists numerical
=)) ; compare
523 (defpackage :lisp-stat-data-clos-example
525 :lift
:lisp-stat-unittests
526 :lisp-stat-data-examples
527 :lisp-stat-data-clos
)
528 (:export absorbtion aluminum iron
))