3 ;;; Time-stamp: <2008-11-02 11:02:26 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
80 sequencep iseq ordered-nneg-seq
81 select split-list which
85 (defpackage :lisp-stat-macros
87 :lisp-stat-compound-data
)
88 (:export make-rv-function make-rv-function-1
))
90 (defpackage :lisp-stat-basics
92 :lisp-stat-object-system
96 :lisp-stat-compound-data
)
97 (:shadowing-import-from
:lisp-stat-object-system
98 slot-value call-method call-next-method
)
99 (:export permute-array sum prod count-elements mean
107 (defpackage :lisp-stat-float
109 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
110 machine-epsilon base-float makedouble
112 make-base-trans-fun-2 make-base-trans-fun
114 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
115 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
116 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
117 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
118 BASE-FROUND BASE-SIGNUM BASE-CIS
))
122 (defpackage :lisp-stat-macros
124 :lisp-stat-compound-data
)
125 (:export make-rv-function make-rv-function-1
))
127 ;;; NEW CLOS STRUCTURE
129 (defpackage :lisp-stat-data-clos
132 (:export get-variable-matrix get-variable-vector
133 ;; generic container class for data -- if small enough
134 ;; could be value, otherwise might be reference.
137 (defpackage :lisp-stat-regression-linear-clos
140 :lisp-stat-data-clos
)
141 (:export regression-model
))
147 (defpackage :lisp-stat-ffi-int
150 (:export ccl-store-integer ccl-store-double ccl-store-ptr
153 (defpackage :lisp-stat-probability
158 (:export log-gamma set-seed
160 normal-cdf normal-quant normal-dens normal-rand
162 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
163 gamma-cdf gamma-quant gamma-dens gamma-rand
164 chisq-cdf chisq-quant chisq-dens chisq-rand
165 beta-cdf beta-quant beta-dens beta-rand
166 t-cdf t-quant t-dens t-rand
167 f-cdf f-quant f-dens f-rand
168 poisson-cdf poisson-quant poisson-pmf poisson-rand
169 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
173 (defpackage :lisp-stat-matrix
176 :lisp-stat-compound-data
)
177 (:export matrixp
;; matrix -- conflicts!
178 num-rows num-cols matmult identity-matrix diagonal
179 row-list column-list inner-product outer-product
180 cross-product transpose bind-columns bind-rows
181 array-data-vector vector-to-array
183 check-matrix check-square-matrix
185 copy-array copy-vector
188 (defpackage :lisp-stat-linalg-data
193 :lisp-stat-compound-data
195 (:export
;; more to add
196 +mode-in
+ +mode-re
+ +mode-cx
+ mode-of
198 la-data-mode la-allocate la-free
200 la-get-double la-put-double
203 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
204 la-vector la-free-vector la-vector-to-data la-data-to-vector
))
207 (defpackage :lisp-stat-math
209 :lisp-stat-object-system
211 :lisp-stat-compound-data
213 (:shadowing-import-from
:lisp-stat-object-system
214 slot-value call-method call-next-method
)
215 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
216 asin acos atan sinh cosh tanh asinh acosh atanh float random
217 truncate floor ceiling round minusp zerop plusp evenp oddp
218 < <= = /= >= > ;; complex
219 conjugate realpart imagpart phase
220 min max logand logior logxor lognot ffloor fceiling
221 ftruncate fround signum cis
)
222 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
223 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
224 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
226 conjugate realpart imagpart phase min max
227 logand logior logxor lognot ffloor fceiling ftruncate fround
229 (:documentation
"Vectorization of numerical functions"))
232 (defpackage :lisp-stat-linalg
239 :lisp-stat-compound-data
240 :lisp-stat-linalg-data
242 (:shadowing-import-from
:lisp-stat-math
243 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
244 asin acos atan sinh cosh tanh asinh acosh atanh float random
245 truncate floor ceiling round minusp zerop plusp evenp oddp
246 < <= = /= >= > complex conjugate realpart imagpart phase
247 min max logand logior logxor lognot ffloor fceiling
248 ftruncate fround signum cis
)
249 (:export chol-decomp lu-decomp lu-solve determinant inverse
250 sv-decomp qr-decomp rcondest make-rotation spline
251 kernel-dens kernel-smooth
252 fft make-sweep-matrix sweep-operator ax
+y eigen
254 check-real
;; for optimize
256 covariance-matrix matrix print-matrix solve
257 backsolve eigenvalues eigenvectors accumulate cumsum combine
261 (defpackage :lisp-stat-config
263 (:export
*default-path
*
264 *lsos-files
* *basic-files
* *ls-files
*
265 *lispstat-data-dir
* *lispstat-examples-dir
*))
268 (defpackage :lisp-stat-data
269 (:documentation
"Data management, integration, I/O, and other data technologies.")
270 (:nicknames
:ls-data
)
272 :lisp-stat-object-system
275 :lisp-stat-compound-data
)
276 (:shadowing-import-from
:lisp-stat-object-system
277 slot-value call-method call-next-method
)
278 (:export open-file-dialog read-data-file read-data-columns load-data
279 load-example
*variables
* *ask-on-redefine
*
280 def variables savevar undef
))
282 (defpackage :lisp-stat-descriptive-statistics
286 :lisp-stat-compound-data
288 :lisp-stat-linalg-data
291 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
292 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
293 asin acos atan sinh cosh tanh asinh acosh atanh float random
294 truncate floor ceiling round minusp zerop plusp evenp oddp
295 < <= = /= >= > ;; complex
296 conjugate realpart imagpart phase
297 min max logand logior logxor lognot ffloor fceiling
298 ftruncate fround signum cis
)
299 (:export standard-deviation quantile median interquartile-range
303 (defpackage :lisp-stat-regression-linear
305 :lisp-stat-object-system
307 :lisp-stat-compound-data
311 :lisp-stat-descriptive-statistics
)
312 (:shadowing-import-from
:lisp-stat-object-system
313 slot-value call-method call-next-method
)
314 (:shadowing-import-from
:lisp-stat-math
315 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
316 asin acos atan sinh cosh tanh asinh acosh atanh float random
317 truncate floor ceiling round minusp zerop plusp evenp oddp
318 < <= = /= >= > ;; complex
319 conjugate realpart imagpart phase
320 min max logand logior logxor lognot ffloor fceiling
321 ftruncate fround signum cis
)
322 (:export regression-model regression-model-proto x y intercept sweep-matrix
323 basis weights included total-sum-of-squares residual-sum-of-squares
324 predictor-names response-name case-labels
))
327 (defpackage :lisp-stat
328 (:documentation
"Experimentation package for LispStat. Serious work
329 should be packaged up elsewhere for reproducibility.")
331 :lisp-stat-object-system
332 :lisp-stat-compound-data
333 :lisp-stat-probability
341 :lisp-stat-descriptive-statistics
342 :lisp-stat-regression-linear
)
343 (:shadowing-import-from
:lisp-stat-object-system
344 slot-value call-method call-next-method
)
345 (:shadowing-import-from
:lisp-stat-math
346 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
347 asin acos atan sinh cosh tanh asinh acosh atanh float random
348 truncate floor ceiling round minusp zerop plusp evenp oddp
349 < <= = /= >= > ;;complex
350 conjugate realpart imagpart phase
351 min max logand logior logxor lognot ffloor fceiling
352 ftruncate fround signum cis
)
359 fixnump check-nonneg-fixnum check-one-fixnum
360 check-one-real check-one-number
368 compound-data-p
*compound-data-proto
* compound-object-p
369 compound-data-seq compound-data-length
370 element-list element-seq
372 recursive-map-elements map-elements
375 get-next-element make-next-element set-next-element
382 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
383 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
384 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
386 conjugate realpart imagpart phase min max
387 logand logior logxor lognot ffloor fceiling ftruncate fround
391 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
392 column-list inner-product outer-product cross-product transpose
393 bind-columns bind-rows
396 chol-decomp lu-decomp lu-solve determinant inverse
397 sv-decomp qr-decomp rcondest make-rotation spline
398 kernel-dens kernel-smooth
399 fft make-sweep-matrix sweep-operator ax
+y eigen
401 covariance-matrix matrix print-matrix solve
402 backsolve eigenvalues eigenvectors accumulate cumsum combine
405 ;; in linalg.lisp, possibly not supported by matlisp
406 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
420 standard-deviation quantile median interquartile-range
425 uniform-rand normal-cdf normal-quant normal-dens
426 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
427 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
428 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
429 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
430 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
431 binomial-cdf binomial-quant binomial-pmf binomial-rand
433 ;;; Here is where we have a problem -- lispstat core should be core
434 ;;; data management and config problems, with packages providing
435 ;;; specialized extensions to LispStat, i.e. regression, nonlin
436 ;;; regression, bayesian regression via laplace approximation, etc.
438 ;;; The following could be considered "recommended packages", similar
439 ;;; to the idea of the recommended packages in R.
442 regression-model regression-model-proto x y intercept sweep-matrix
443 basis weights included total-sum-of-squares residual-sum-of-squares
444 predictor-names response-name case-labels
447 nreg-model nreg-model-proto mean-function theta-hat epsilon
451 bayes-model bayes-model-proto bayes-internals
))
455 (defpackage :lisp-stat-user
456 (:documentation
"Experimentation package for LispStat.
457 Serious work should be placed in a similar package elsewhere for
458 reproducibility. But this should hint as to what needs to be
459 done for a user- or analysis-package.")
460 (:nicknames
:ls-user
)
463 (:shadowing-import-from
:lisp-stat
464 slot-value call-method call-next-method
466 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
467 asin acos atan sinh cosh tanh asinh acosh atanh float random
468 truncate floor ceiling round minusp zerop plusp evenp oddp
469 < <= = /= >= > > ;; complex
470 conjugate realpart imagpart phase
471 min max logand logior logxor lognot ffloor fceiling
472 ftruncate fround signum cis
477 (defpackage :lisp-stat-data-examples
478 (:documentation
"Example data used for unittests and illustrations,")
481 (:shadowing-import-from
:lisp-stat
482 slot-value call-method call-next-method
484 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
485 asin acos atan sinh cosh tanh asinh acosh atanh float random
486 truncate floor ceiling round minusp zerop plusp evenp oddp
487 < <= = /= >= > > ;; complex
488 conjugate realpart imagpart phase
489 min max logand logior logxor lognot ffloor fceiling
490 ftruncate fround signum cis
493 (:export iron aluminum diabetes
))
497 (defpackage :lisp-stat-unittests
498 (:use
:common-lisp
:lift
:lisp-stat
)
499 (:shadowing-import-from
:lisp-stat
500 slot-value call-method call-next-method
;; objects
501 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
502 asin acos atan sinh cosh tanh asinh acosh atanh float random
503 truncate floor ceiling round minusp zerop plusp evenp oddp
504 < <= = /= >= > ;; complex
505 conjugate realpart imagpart phase
506 min max logand logior logxor lognot ffloor fceiling
507 ftruncate fround signum cis
)
508 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
509 almost
= almost
=lists numerical
=)) ; compare
511 (defpackage :lisp-stat-unittests-arrays
512 (:use
:common-lisp
:lift
:lisp-matrix
:lisp-stat
513 :lisp-stat-unittests
) ;; support
514 (:shadowing-import-from
:lisp-stat
516 slot-value call-method call-next-method
518 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
519 asin acos atan sinh cosh tanh asinh acosh atanh float random
520 truncate floor ceiling round minusp zerop plusp evenp oddp
521 < <= = /= >= > min max logand logior logxor lognot ffloor fceiling
522 ftruncate fround signum cis
524 conjugate realpart imagpart phase
)
525 (:shadowing-import-from
:lisp-matrix transpose
)
526 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
))
530 (defpackage :lisp-stat-types-unittests
532 :lift
:lisp-stat-unittests
535 (defpackage :lisp-stat-data-clos-example
537 :lift
:lisp-stat-unittests
538 :lisp-stat-data-clos
))
540 (defpackage :lisp-stat-unittests-proto
541 (:use
:common-lisp
:lift
:lisp-stat
:lisp-stat-unittests
)
542 (:shadowing-import-from
:lisp-stat
543 slot-value call-method call-next-method
;; objects
544 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
545 asin acos atan sinh cosh tanh asinh acosh atanh float random
546 truncate floor ceiling round minusp zerop plusp evenp oddp
547 < <= = /= >= > ;; complex
548 conjugate realpart imagpart phase
549 min max logand logior logxor lognot ffloor fceiling
550 ftruncate fround signum cis
)
551 (:export lisp-stat-ut-proto
)) ;; unit tests -- rename?
554 (defpackage :lisp-stat-regression-unittests
558 :lisp-stat-data-examples
559 :lisp-stat-unittests
)
560 (:shadowing-import-from
:lisp-stat
561 slot-value call-method call-next-method
;; objects
562 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
563 asin acos atan sinh cosh tanh asinh acosh atanh float random
564 truncate floor ceiling round minusp zerop plusp evenp oddp
565 < <= = /= >= > ;; complex
566 conjugate realpart imagpart phase
567 min max logand logior logxor lognot ffloor fceiling
568 ftruncate fround signum cis
)