3 ;;; Time-stamp: <2009-07-12 13:01:09 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.
20 (defpackage :lisp-stat-object-system
21 (:nicknames
:ls-objects
:lsos
)
23 (:shadow
:call-method
:call-next-method
)
24 (:export ls-object objectp
*object
* kind-of-p make-object
26 *set-slot-hook
* proto-slot-value self
27 send call-next-method call-method
28 defmeth defproto instance-slots proto-name
))
30 (defpackage :lisp-stat-types
31 (:documentation
"Provides some typeing for LispStat, but is clearly
35 check-nonneg-fixnum check-one-nonneg-fixnum
36 check-one-fixnum check-one-real check-one-number
))
38 (defpackage :lisp-stat-float
40 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
41 machine-epsilon base-float makedouble
43 make-base-trans-fun-2 make-base-trans-fun
45 base-log base-exp base-expt base-sqrt base-sin base-cos
46 base-tan base-asin base-acos base-atan base-sinh
47 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
48 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
49 BASE-FROUND BASE-SIGNUM BASE-CIS
))
51 (defpackage :lisp-stat-compound-data
53 :lisp-stat-object-system
55 (:shadowing-import-from
:lisp-stat-object-system
56 call-next-method call-method
)
57 (:export compound-data-p
*compound-data-proto
*
59 compound-data-seq compound-data-length
60 element-list element-seq
62 recursive-map-elements map-elements repeat
64 get-next-element make-next-element set-next-element
67 select split-list which
71 (defpackage :lisp-stat-macros
73 :lisp-stat-compound-data
)
74 (:export make-rv-function make-rv-function-1
))
76 (defpackage :lisp-stat-basics
78 :lisp-stat-object-system
82 :lisp-stat-compound-data
)
83 (:shadowing-import-from
:lisp-stat-object-system
84 call-method call-next-method
)
85 (:export permute-array sum prod count-elements mean
88 (defpackage :lisp-stat-float
90 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
91 machine-epsilon base-float makedouble
93 make-base-trans-fun-2 make-base-trans-fun
95 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
96 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
97 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
98 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
99 BASE-FROUND BASE-SIGNUM BASE-CIS
))
101 (defpackage :lisp-stat-macros
103 :lisp-stat-compound-data
)
104 (:export make-rv-function make-rv-function-1
))
106 ;;; NEW CLOS STRUCTURE
110 (defpackage :cls-dataframe
114 ;; generic container class for data -- if small enough
115 ;; could be value, otherwise might be reference.
121 varlabels caselabels nrows ncols
122 dataframe-dimension dataframe-dimensons
123 dfref dfref-case dfref-var
124 consistent-dataframe-p
127 list-of-columns
;; list-of-variables
128 list-of-rows
;; list-of-observations
132 (defpackage :cls-data-listoflist
135 :cls-dataframe
) ; for dataframe
136 (:export lists-of-same-size
139 listoflist-
>dataframe
141 listoflist-
>matrix-like
))
144 (defpackage :cls-dataimport
145 (:documentation
"Data I/O and similar import technologies.")
147 :lisp-stat-object-system
151 (:shadowing-import-from
:lisp-stat-object-system
152 call-method call-next-method
)
153 (:export dsvstream-
>dataframe dsvstream-
>matrix dsvstream-
>listoflist
))
156 (defpackage :lisp-stat-model
157 (:documentation
"Model management for data analysis.")
161 ;; data structures for model and model/data combination
162 model statistical-model analysis
))
166 (defpackage :cls-visualize
172 (defpackage :cls-visualize-plplot
179 plot-ex contour-plot-ex fn-contour-plot-ex shade-plot-ex
3D-plot-ex
))
184 (defpackage :lisp-stat-ffi-int
187 (:export ccl-store-integer ccl-store-double ccl-store-ptr
190 (defpackage :lisp-stat-probability
195 (:export log-gamma set-seed
197 normal-cdf normal-quant normal-dens normal-rand
199 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
200 gamma-cdf gamma-quant gamma-dens gamma-rand
201 chisq-cdf chisq-quant chisq-dens chisq-rand
202 beta-cdf beta-quant beta-dens beta-rand
203 t-cdf t-quant t-dens t-rand
204 f-cdf f-quant f-dens f-rand
205 poisson-cdf poisson-quant poisson-pmf poisson-rand
206 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
210 (defpackage :lisp-stat-math
212 :lisp-stat-object-system
214 :lisp-stat-compound-data
216 (:shadowing-import-from
:lisp-stat-object-system
217 call-method call-next-method
)
218 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
219 asin acos atan sinh cosh tanh asinh acosh atanh float random
220 truncate floor ceiling round minusp zerop plusp evenp oddp
221 < <= = /= >= > ;; complex
222 conjugate realpart imagpart phase
223 min max logand logior logxor lognot ffloor fceiling
224 ftruncate fround signum cis
)
225 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
226 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
227 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
229 conjugate realpart imagpart phase min max
230 logand logior logxor lognot ffloor fceiling ftruncate fround
232 (:documentation
"Vectorization of numerical functions"))
235 #|
;; some of this goes back in, but not all of it?
236 (defpackage :lisp-stat-linalg
243 :lisp-stat-compound-data
)
244 (:shadowing-import-from
:lisp-stat-math
245 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
246 asin acos atan sinh cosh tanh asinh acosh atanh float random
247 truncate floor ceiling round minusp zerop plusp evenp oddp
248 < <= = /= >= > complex conjugate realpart imagpart phase
249 min max logand logior logxor lognot ffloor fceiling
250 ftruncate fround signum cis
)
251 (:export chol-decomp lu-decomp lu-solve determinant inverse
252 sv-decomp qr-decomp rcondest make-rotation spline
253 kernel-dens kernel-smooth
254 fft make-sweep-matrix sweep-operator ax
+y eigen
256 check-real
;; for optimize
258 covariance-matrix matrix print-matrix solve
259 backsolve eigenvalues eigenvectors accumulate cumsum combine
267 (defpackage :lisp-stat-data
268 (:documentation
"Data management, integration, I/O, and other data technologies.")
269 (:nicknames
:ls-data
)
271 :lisp-stat-object-system
274 :lisp-stat-compound-data
)
275 (:shadowing-import-from
:lisp-stat-object-system
276 call-method call-next-method
)
277 (:export open-file-dialog read-data-file read-data-columns load-data
278 load-example
*variables
* *ask-on-redefine
*
279 def variables savevar undef
))
281 (defpackage :lisp-stat-descriptive-statistics
285 :lisp-stat-compound-data
288 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
289 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
290 asin acos atan sinh cosh tanh asinh acosh atanh float random
291 truncate floor ceiling round minusp zerop plusp evenp oddp
292 < <= = /= >= > ;; complex
293 conjugate realpart imagpart phase
294 min max logand logior logxor lognot ffloor fceiling
295 ftruncate fround signum cis
)
296 (:export standard-deviation
297 quantile median interquartile-range
301 (defpackage :lisp-stat-regression-linear
305 :lisp-stat-compound-data
306 :lisp-stat-descriptive-statistics
)
307 (:shadowing-import-from
:lisp-stat-object-system
308 call-method call-next-method
)
309 (:export regression-model fit-model
311 estimates covariance-matrix
312 ;; functions for helpers
314 print-object
;; for method dispatch
317 (defpackage :common-lisp-statistics
318 (:documentation
"Experimentation package for LispStat. Serious work
319 should be packaged up elsewhere for reproducibility. By this I
320 mean, creating a data/analytics/analysis package with the minimal
321 set of objects required.")
322 (:nicknames
:cls
:common-lisp-statistics
:lisp-stat
)
325 :lisp-stat-object-system
326 :lisp-stat-compound-data
327 :lisp-stat-probability
335 :lisp-matrix
;; conversion to a more robust linalg approach
336 :lisp-stat-descriptive-statistics
337 :lisp-stat-regression-linear
340 ;; :cls-visualize-plplot
342 (:shadowing-import-from
:lisp-stat-object-system
343 call-method call-next-method
)
344 (:shadowing-import-from
:lisp-stat-math
345 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
346 asin acos atan sinh cosh tanh asinh acosh atanh float random
347 truncate floor ceiling round minusp zerop plusp evenp oddp
350 conjugate realpart imagpart phase
353 logand logior logxor lognot
354 ffloor fceiling ftruncate fround
358 *default-path
* *lsos-files
* *basic-files
* *ls-files
*
359 *lispstat-home-dir
* *lispstat-data-dir
* *lispstat-examples-dir
*
363 defmeth send proto-slot-value
366 fixnump check-nonneg-fixnum check-one-fixnum
367 check-one-nonneg-fixnum
368 check-one-real check-one-number
376 compound-data-p
*compound-data-proto
* compound-object-p
377 compound-data-seq compound-data-length
378 element-list element-seq
380 recursive-map-elements map-elements
383 get-next-element make-next-element set-next-element
391 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
392 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
393 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
395 conjugate realpart imagpart phase min max
396 logand logior logxor lognot ffloor fceiling ftruncate fround
399 #|
;; The following need to be re-found in lisp-matrix...
402 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
403 column-list inner-product outer-product cross-product transpose
404 bind-columns bind-rows
407 chol-decomp lu-decomp lu-solve determinant inverse
408 sv-decomp qr-decomp rcondest make-rotation spline
409 kernel-dens kernel-smooth
410 fft make-sweep-matrix sweep-operator ax
+y eigen
412 covariance-matrix matrix print-matrix solve
413 backsolve eigenvalues eigenvectors accumulate cumsum combine
416 ;; in linalg.lisp, possibly not supported by matlisp
417 spline kernel-dens kernel-smooth
425 make-rv-function make-rv-function-1
428 xref xtype xdims xdim xdims
*
431 open-file-dialog read-data-file read-data-columns load-data
432 load-example
*variables
* *ask-on-redefine
*
433 def variables savevar undef
436 dataframe-like dataframe-array make-dataframe
437 varlabels caselabels nrows ncols
438 dataframe-dimension dataframe-dimensons
439 dfref dfref-case dfref-var
440 consistent-dataframe-p
442 list-of-columns list-of-rows
447 lists-of-same-size equal-listoflist
449 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
451 ;; statistics.lsp (descriptions, should probably be moved
453 standard-deviation quantile median interquartile-range
456 ;; probability (dists.lisp)
458 uniform-rand normal-cdf normal-quant normal-dens
459 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
460 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
461 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
462 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
463 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
464 binomial-cdf binomial-quant binomial-pmf binomial-rand
466 ;; Here is where we have a problem -- lispstat core should be core
467 ;; data management and config problems, with packages providing
468 ;; specialized extensions to LispStat, i.e. regression, nonlin
469 ;; regression, bayesian regression via laplace approximation, etc.
471 ;; The following could be considered "recommended packages",
472 ;; similar to the idea of the recommended packages in R. Probably
473 ;; we want them to do the exporting within that package, therefore
474 ;; NOT being able to lock the "data-ish" package, but only the
475 ;; subpackages prior to export.
478 ;; -- linear regressin models.
479 regression-model fit-model
480 estimates covariance-matrix
482 regression-model-proto x y intercept sweep-matrix
483 basis weights included total-sum-of-squares residual-sum-of-squares
484 predictor-names response-name case-labels
488 ;; -- nonlinear regression models
489 nreg-model nreg-model-proto mean-function theta-hat epsilon
491 ;; we might need something like xtxinv here? But should be
492 ;; encapsulated, so we use the one in regression.lisp
495 bayes-model bayes-model-proto bayes-internals
507 ;;;; PACKAGES FOR USEABILITY
509 (defpackage :lisp-stat-data-examples
510 (:documentation
"Example data for unittests, examples, illustrations,")
512 :common-lisp-statistics
)
513 (:shadowing-import-from
:lisp-stat
514 call-method call-next-method
516 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
517 asin acos atan sinh cosh tanh asinh acosh atanh float random
518 truncate floor ceiling round minusp zerop plusp evenp oddp
519 < <= = /= >= > > ;; complex
520 conjugate realpart imagpart phase
521 min max logand logior logxor lognot ffloor fceiling
522 ftruncate fround signum cis
525 (:export iron aluminum absorbtion
529 (defpackage :lisp-stat-user
530 (:documentation
"Experimentation package for LispStat. Serious work
531 should be placed in a similar package elsewhere for
532 reproducibility. But this should hint as to what needs to be done
533 for a user- or analysis-package.")
534 (:nicknames
:ls-user
)
535 (:use
:common-lisp
; always needed for user playgrounds!
537 :common-lisp-statistics
538 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
539 (:shadowing-import-from
:lisp-stat
540 call-method call-next-method
542 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
543 asin acos atan sinh cosh tanh asinh acosh atanh float random
544 truncate floor ceiling round minusp zerop plusp evenp oddp
545 < <= = /= >= > > ;; complex
546 conjugate realpart imagpart phase
547 min max logand logior logxor lognot ffloor fceiling
548 ftruncate fround signum cis
552 (defpackage :lisp-stat-unittests
555 :lisp-stat
:lisp-stat-data-examples
)
556 (:shadowing-import-from
:lisp-stat
557 call-method call-next-method
;; objects
558 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
559 asin acos atan sinh cosh tanh asinh acosh atanh float random
560 truncate floor ceiling round minusp zerop plusp evenp oddp
561 < <= = /= >= > ;; complex
562 conjugate realpart imagpart phase
563 min max logand logior logxor lognot ffloor fceiling
564 ftruncate fround signum cis
)
565 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
566 almost
= almost
=lists numerical
=)) ; compare
568 (defpackage :cls-dataframe-example
570 :lift
:lisp-stat-unittests
571 :lisp-stat-data-examples
573 (:export absorbtion aluminum iron
))
576 (defpackage :lisp-stat-optimize
581 :lisp-stat-object-system
583 :lisp-stat-compound-data
589 :lisp-stat-linalg-data
593 (:shadowing-import-from
:lisp-stat-object-system
594 call-method call-next-method
)
595 (:shadowing-import-from
:lisp-stat-math
596 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
597 asin acos atan sinh cosh tanh asinh acosh atanh float random
598 truncate floor ceiling round minusp zerop plusp evenp oddp
599 < <= = /= >= > complex conjugate realpart imagpart phase
600 min max logand logior logxor lognot ffloor fceiling
601 ftruncate fround signum cis
)
607 newtonmax nelmeadmax
))