3 ;;; Time-stamp: <2009-09-24 11:41:52 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.
17 ;;; Current structure, dependencies:
20 (ls-user :depends-on lisp-stat
)
21 (lisp-stat :depends-on
'(cls-dataframe
25 (cls-dataframe :depends-on cls-data
)
33 (defpackage :lisp-stat-object-system
34 (:nicknames
:ls-objects
:lsos
)
36 (:shadow
:call-method
:call-next-method
)
37 (:export ls-object objectp
*object
* kind-of-p make-object
39 *set-slot-hook
* proto-slot-value self
40 send call-next-method call-method
41 defmeth defproto instance-slots proto-name
))
43 ;;; -types and -float probably ought to be moved into a -numerics
46 (defpackage :lisp-stat-types
47 (:documentation
"Provides some typeing for LispStat, but is clearly
51 check-nonneg-fixnum check-one-nonneg-fixnum
52 check-one-fixnum check-one-real check-one-number
))
54 (defpackage :lisp-stat-float
56 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
57 machine-epsilon base-float makedouble
59 make-base-trans-fun-2 make-base-trans-fun
61 base-log base-exp base-expt base-sqrt base-sin base-cos
62 base-tan base-asin base-acos base-atan base-sinh
63 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
64 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
65 BASE-FROUND BASE-SIGNUM BASE-CIS
))
67 ;;; Probably should move into cls-data package.
69 (defpackage :lisp-stat-compound-data
71 :lisp-stat-object-system
73 (:shadowing-import-from
:lisp-stat-object-system
74 call-next-method call-method
)
75 (:export compound-data-p
*compound-data-proto
*
77 compound-data-seq compound-data-length
78 element-list element-seq
80 recursive-map-elements map-elements repeat
82 get-next-element make-next-element set-next-element
85 select split-list which
89 (defpackage :lisp-stat-macros
91 :lisp-stat-compound-data
)
92 (:export make-rv-function make-rv-function-1
))
94 (defpackage :lisp-stat-basics
96 :lisp-stat-object-system
100 :lisp-stat-compound-data
)
101 (:shadowing-import-from
:lisp-stat-object-system
102 call-method call-next-method
)
103 (:export permute-array sum prod count-elements mean
106 (defpackage :lisp-stat-float
108 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
109 machine-epsilon base-float makedouble
111 make-base-trans-fun-2 make-base-trans-fun
113 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
114 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
115 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
116 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
117 BASE-FROUND BASE-SIGNUM BASE-CIS
))
119 (defpackage :lisp-stat-macros
121 :lisp-stat-compound-data
)
122 (:export make-rv-function make-rv-function-1
))
125 (defpackage :cls-matrix
126 (:documentation
"basic utilities for using lisp arrays as numerical
127 matrices. Not optimized, and must consider this slow. Routines
128 should be optimized, it is only that we need them first, optimize
131 (:export matrixp num-rows num-cols matmult identity-matrix diagonal
132 row-list column-list inner-product outer-product
133 cross-product transpose bind-columns bind-rows
134 array-data-vector vector-to-array
))
137 ;;; NEW CLOS STRUCTURE
139 ;;; cls-data... in dataframe, though.
140 (defpackage :cls-dataframe
144 (:shadowing-import-from
:xarray slice
)
146 ;; generic container class for data -- if small enough
147 ;; could be value, otherwise might be reference.
153 varlabels caselabels nrows ncols
154 dataframe-dimension dataframe-dimensons
155 xref xtype xdims xdim xrank slice take carray
157 dfref dfref-case dfref-var
158 consistent-dataframe-p
162 list-of-columns
;; list-of-variables
163 list-of-rows
;; list-of-observations
166 (defpackage :cls-data
170 :cls-dataframe
) ; for dataframe
171 (:shadowing-import-from
:xarray slice
)
172 (:export listoflist-
>dataframe
174 listoflist-
>matrix-like
))
181 (defpackage :cls-dataimport
182 (:documentation
"Data I/O and similar import technologies.")
184 :lisp-stat-object-system
188 (:shadowing-import-from
:lisp-stat-object-system
189 call-method call-next-method
)
190 (:export dsvstream-
>dataframe dsvstream-
>matrix dsvstream-
>listoflist
))
193 (defpackage :lisp-stat-model
194 (:documentation
"Model management for data analysis.")
198 ;; data structures for model and model/data combination
199 model statistical-model analysis
))
203 (defpackage :cls-visualize
207 (:shadowing-import-from
:xarray slice
)
211 (defpackage :cls-visualize-plplot
218 plot-ex contour-plot-ex fn-contour-plot-ex shade-plot-ex
3D-plot-ex
))
223 (defpackage :lisp-stat-ffi-int
226 (:export ccl-store-integer ccl-store-double ccl-store-ptr
229 (defpackage :lisp-stat-probability
234 (:export log-gamma set-seed
236 normal-cdf normal-quant normal-dens normal-rand
238 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
239 gamma-cdf gamma-quant gamma-dens gamma-rand
240 chisq-cdf chisq-quant chisq-dens chisq-rand
241 beta-cdf beta-quant beta-dens beta-rand
242 t-cdf t-quant t-dens t-rand
243 f-cdf f-quant f-dens f-rand
244 poisson-cdf poisson-quant poisson-pmf poisson-rand
245 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
249 (defpackage :lisp-stat-math
251 :lisp-stat-object-system
253 :lisp-stat-compound-data
255 (:shadowing-import-from
:lisp-stat-object-system
256 call-method call-next-method
)
257 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
258 asin acos atan sinh cosh tanh asinh acosh atanh float random
259 truncate floor ceiling round minusp zerop plusp evenp oddp
260 < <= = /= >= > ;; complex
261 conjugate realpart imagpart phase
262 min max logand logior logxor lognot ffloor fceiling
263 ftruncate fround signum cis
)
264 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
265 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
266 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
268 conjugate realpart imagpart phase min max
269 logand logior logxor lognot ffloor fceiling ftruncate fround
271 (:documentation
"Vectorization of numerical functions"))
274 #|
;; some of this goes back in, but not all of it?
275 (defpackage :lisp-stat-linalg
282 :lisp-stat-compound-data
)
283 (:shadowing-import-from
:lisp-stat-math
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 conjugate realpart imagpart phase
288 min max logand logior logxor lognot ffloor fceiling
289 ftruncate fround signum cis
)
290 (:export chol-decomp lu-decomp lu-solve determinant inverse
291 sv-decomp qr-decomp rcondest make-rotation spline
292 kernel-dens kernel-smooth
293 fft make-sweep-matrix sweep-operator ax
+y eigen
295 check-real
;; for optimize
297 covariance-matrix matrix print-matrix solve
298 backsolve eigenvalues eigenvectors accumulate cumsum combine
306 (defpackage :lisp-stat-data
307 (:documentation
"Data management, integration, I/O, and other data technologies.")
308 (:nicknames
:ls-data
)
310 :lisp-stat-object-system
313 :lisp-stat-compound-data
)
314 (:shadowing-import-from
:lisp-stat-object-system
315 call-method call-next-method
)
316 (:export open-file-dialog read-data-file read-data-columns load-data
317 load-example
*variables
* *ask-on-redefine
*
318 def variables savevar undef
))
320 (defpackage :lisp-stat-descriptive-statistics
325 :lisp-stat-compound-data
327 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
328 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
329 asin acos atan sinh cosh tanh asinh acosh atanh float random
330 truncate floor ceiling round minusp zerop plusp evenp oddp
331 < <= = /= >= > ;; complex
332 conjugate realpart imagpart phase
333 min max logand logior logxor lognot ffloor fceiling
334 ftruncate fround signum cis
)
335 (:export mean standard-deviation variance
336 quantile median interquartile-range
339 (defpackage :lisp-stat-regression-linear
343 :lisp-stat-compound-data
344 :lisp-stat-descriptive-statistics
)
345 (:shadowing-import-from
:lisp-stat-object-system
346 call-method call-next-method
)
347 (:export regression-model fit-model
349 estimates covariance-matrix
350 ;; functions for helpers
352 print-object
;; for method dispatch
355 (defpackage :common-lisp-statistics
356 (:documentation
"Experimentation package for LispStat. Serious work
357 should be packaged up as a separate but similar package to help
358 drive reproducibility. By this I mean, creating a
359 data/analytics/analysis package with the minimal set of
360 objects/packages required.")
361 (:nicknames
:cls
:common-lisp-statistics
:lisp-stat
)
363 :xarray
;; generic reference -- internally supporting array, lol structs
364 :lisp-matrix
;; conversion to a more robust linalg approach
366 :lisp-stat-object-system
367 :lisp-stat-compound-data
368 :lisp-stat-probability
376 :lisp-stat-descriptive-statistics
377 :lisp-stat-regression-linear
380 ;; :cls-visualize-plplot
382 (:shadowing-import-from
:xarray slice
)
383 (:shadowing-import-from
:lisp-stat-object-system
384 call-method call-next-method
)
385 (:shadowing-import-from
:lisp-stat-math
386 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
387 asin acos atan sinh cosh tanh asinh acosh atanh float random
388 truncate floor ceiling round minusp zerop plusp evenp oddp
391 conjugate realpart imagpart phase
394 logand logior logxor lognot
395 ffloor fceiling ftruncate fround
399 *default-path
* *lsos-files
* *basic-files
* *ls-files
*
400 *lispstat-home-dir
* *lispstat-data-dir
* *lispstat-examples-dir
*
404 defmeth send proto-slot-value
407 fixnump check-nonneg-fixnum check-one-fixnum
408 check-one-nonneg-fixnum
409 check-one-real check-one-number
417 compound-data-p
*compound-data-proto
* compound-object-p
418 compound-data-seq compound-data-length
419 element-list element-seq
421 recursive-map-elements map-elements
424 get-next-element make-next-element set-next-element
432 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
433 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
434 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
436 conjugate realpart imagpart phase min max
437 logand logior logxor lognot ffloor fceiling ftruncate fround
440 #|
;; The following need to be re-found in lisp-matrix...
443 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
444 column-list inner-product outer-product cross-product transpose
445 bind-columns bind-rows
448 chol-decomp lu-decomp lu-solve determinant inverse
449 sv-decomp qr-decomp rcondest make-rotation spline
450 kernel-dens kernel-smooth
451 fft make-sweep-matrix sweep-operator ax
+y eigen
453 covariance-matrix matrix print-matrix solve
454 backsolve eigenvalues eigenvectors accumulate cumsum combine
457 ;; in linalg.lisp, possibly not supported by matlisp
458 spline kernel-dens kernel-smooth
466 make-rv-function make-rv-function-1
469 xref xtype xdims xdim xdims
*
470 lists-of-same-size equal-listoflist transpose-listoflist
473 open-file-dialog read-data-file read-data-columns load-data
474 load-example
*variables
* *ask-on-redefine
*
475 def variables savevar undef
478 dataframe-like dataframe-array make-dataframe
479 varlabels caselabels nrows ncols
480 dataframe-dimension dataframe-dimensons
481 dfref dfref-case dfref-var
482 consistent-dataframe-p
483 dataset list-of-columns list-of-rows
486 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
488 ;; statistics.lsp (descriptions, should probably be moved
490 standard-deviation quantile median interquartile-range
493 ;; probability (dists.lisp)
495 uniform-rand normal-cdf normal-quant normal-dens
496 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
497 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
498 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
499 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
500 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
501 binomial-cdf binomial-quant binomial-pmf binomial-rand
503 ;; Here is where we have a problem -- lispstat core should be core
504 ;; data management and config problems, with packages providing
505 ;; specialized extensions to LispStat, i.e. regression, nonlin
506 ;; regression, bayesian regression via laplace approximation, etc.
508 ;; The following could be considered "recommended packages",
509 ;; similar to the idea of the recommended packages in R. Probably
510 ;; we want them to do the exporting within that package, therefore
511 ;; NOT being able to lock the "data-ish" package, but only the
512 ;; subpackages prior to export.
515 ;; -- linear regressin models.
516 regression-model fit-model
517 estimates covariance-matrix
519 regression-model-proto x y intercept sweep-matrix
520 basis weights included total-sum-of-squares residual-sum-of-squares
521 predictor-names response-name case-labels
525 ;; -- nonlinear regression models
526 nreg-model nreg-model-proto mean-function theta-hat epsilon
528 ;; we might need something like xtxinv here? But should be
529 ;; encapsulated, so we use the one in regression.lisp
532 bayes-model bayes-model-proto bayes-internals
544 ;;;; PACKAGES FOR USEABILITY
546 (defpackage :lisp-stat-data-examples
547 (:documentation
"Example data for unittests, examples, illustrations,")
549 :common-lisp-statistics
)
550 (:shadowing-import-from
:lisp-stat
551 call-method call-next-method
553 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
554 asin acos atan sinh cosh tanh asinh acosh atanh float random
555 truncate floor ceiling round minusp zerop plusp evenp oddp
556 < <= = /= >= > > ;; complex
557 conjugate realpart imagpart phase
558 min max logand logior logxor lognot ffloor fceiling
559 ftruncate fround signum cis
562 (:export iron aluminum absorbtion
566 (defpackage :lisp-stat-user
567 (:documentation
"Experimentation package for LispStat. Serious work
568 should be placed in a similar package elsewhere for
569 reproducibility. But this should hint as to what needs to be done
570 for a user- or analysis-package.")
571 (:nicknames
:ls-user
)
572 (:use
:common-lisp
; always needed for user playgrounds!
574 :common-lisp-statistics
575 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
576 (:shadowing-import-from
:lisp-stat
577 call-method call-next-method
579 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
580 asin acos atan sinh cosh tanh asinh acosh atanh float random
581 truncate floor ceiling round minusp zerop plusp evenp oddp
582 < <= = /= >= > > ;; complex
583 conjugate realpart imagpart phase
584 min max logand logior logxor lognot ffloor fceiling
585 ftruncate fround signum cis
589 (defpackage :lisp-stat-unittests
592 :lisp-stat
:lisp-stat-data-examples
)
593 (:shadowing-import-from
:lisp-stat
594 call-method call-next-method
;; objects
595 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
596 asin acos atan sinh cosh tanh asinh acosh atanh float random
597 truncate floor ceiling round minusp zerop plusp evenp oddp
598 < <= = /= >= > ;; complex
599 conjugate realpart imagpart phase
600 min max logand logior logxor lognot ffloor fceiling
601 ftruncate fround signum cis
)
602 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
603 almost
= almost
=lists numerical
=)) ; compare
605 (defpackage :cls-dataframe-example
607 :lift
:lisp-stat-unittests
608 :lisp-stat-data-examples
610 (:export absorbtion aluminum iron
))
613 (defpackage :lisp-stat-optimize
618 :lisp-stat-object-system
620 :lisp-stat-compound-data
626 :lisp-stat-linalg-data
630 (:shadowing-import-from
:lisp-stat-object-system
631 call-method call-next-method
)
632 (:shadowing-import-from
:lisp-stat-math
633 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
634 asin acos atan sinh cosh tanh asinh acosh atanh float random
635 truncate floor ceiling round minusp zerop plusp evenp oddp
636 < <= = /= >= > complex conjugate realpart imagpart phase
637 min max logand logior logxor lognot ffloor fceiling
638 ftruncate fround signum cis
)
644 newtonmax nelmeadmax
))