3 ;;; Time-stamp: <2009-07-14 19:17: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.
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 ;;; -types and -float probably ought to be moved into a -numerics
33 (defpackage :lisp-stat-types
34 (:documentation
"Provides some typeing for LispStat, but is clearly
38 check-nonneg-fixnum check-one-nonneg-fixnum
39 check-one-fixnum check-one-real check-one-number
))
41 (defpackage :lisp-stat-float
43 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
44 machine-epsilon base-float makedouble
46 make-base-trans-fun-2 make-base-trans-fun
48 base-log base-exp base-expt base-sqrt base-sin base-cos
49 base-tan base-asin base-acos base-atan base-sinh
50 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
51 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
52 BASE-FROUND BASE-SIGNUM BASE-CIS
))
54 ;;; Probably should move into cls-data package.
56 (defpackage :lisp-stat-compound-data
58 :lisp-stat-object-system
60 (:shadowing-import-from
:lisp-stat-object-system
61 call-next-method call-method
)
62 (:export compound-data-p
*compound-data-proto
*
64 compound-data-seq compound-data-length
65 element-list element-seq
67 recursive-map-elements map-elements repeat
69 get-next-element make-next-element set-next-element
72 select split-list which
76 (defpackage :lisp-stat-macros
78 :lisp-stat-compound-data
)
79 (:export make-rv-function make-rv-function-1
))
81 (defpackage :lisp-stat-basics
83 :lisp-stat-object-system
87 :lisp-stat-compound-data
)
88 (:shadowing-import-from
:lisp-stat-object-system
89 call-method call-next-method
)
90 (:export permute-array sum prod count-elements mean
93 (defpackage :lisp-stat-float
95 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
96 machine-epsilon base-float makedouble
98 make-base-trans-fun-2 make-base-trans-fun
100 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
101 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
102 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
103 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
104 BASE-FROUND BASE-SIGNUM BASE-CIS
))
106 (defpackage :lisp-stat-macros
108 :lisp-stat-compound-data
)
109 (:export make-rv-function make-rv-function-1
))
111 ;;; NEW CLOS STRUCTURE
113 ;;; cls-data... in dataframe, though.
114 (defpackage :cls-dataframe
119 ;; generic container class for data -- if small enough
120 ;; could be value, otherwise might be reference.
126 varlabels caselabels nrows ncols
127 dataframe-dimension dataframe-dimensons
128 xref xtype xdims xdim xrank slice take carray
130 dfref dfref-case dfref-var
131 consistent-dataframe-p
135 list-of-columns
;; list-of-variables
136 list-of-rows
;; list-of-observations
139 ;; move to cls-data -- but in listoflist.lisp
140 (defpackage :cls-data-listoflist
143 :cls-dataframe
) ; for dataframe
144 (:export lists-of-same-size
147 listoflist-
>dataframe
149 listoflist-
>matrix-like
))
152 (defpackage :cls-dataimport
153 (:documentation
"Data I/O and similar import technologies.")
155 :lisp-stat-object-system
159 (:shadowing-import-from
:lisp-stat-object-system
160 call-method call-next-method
)
161 (:export dsvstream-
>dataframe dsvstream-
>matrix dsvstream-
>listoflist
))
164 (defpackage :lisp-stat-model
165 (:documentation
"Model management for data analysis.")
169 ;; data structures for model and model/data combination
170 model statistical-model analysis
))
174 (defpackage :cls-visualize
180 (defpackage :cls-visualize-plplot
187 plot-ex contour-plot-ex fn-contour-plot-ex shade-plot-ex
3D-plot-ex
))
192 (defpackage :lisp-stat-ffi-int
195 (:export ccl-store-integer ccl-store-double ccl-store-ptr
198 (defpackage :lisp-stat-probability
203 (:export log-gamma set-seed
205 normal-cdf normal-quant normal-dens normal-rand
207 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
208 gamma-cdf gamma-quant gamma-dens gamma-rand
209 chisq-cdf chisq-quant chisq-dens chisq-rand
210 beta-cdf beta-quant beta-dens beta-rand
211 t-cdf t-quant t-dens t-rand
212 f-cdf f-quant f-dens f-rand
213 poisson-cdf poisson-quant poisson-pmf poisson-rand
214 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
218 (defpackage :lisp-stat-math
220 :lisp-stat-object-system
222 :lisp-stat-compound-data
224 (:shadowing-import-from
:lisp-stat-object-system
225 call-method call-next-method
)
226 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
227 asin acos atan sinh cosh tanh asinh acosh atanh float random
228 truncate floor ceiling round minusp zerop plusp evenp oddp
229 < <= = /= >= > ;; complex
230 conjugate realpart imagpart phase
231 min max logand logior logxor lognot ffloor fceiling
232 ftruncate fround signum cis
)
233 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
234 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
235 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
237 conjugate realpart imagpart phase min max
238 logand logior logxor lognot ffloor fceiling ftruncate fround
240 (:documentation
"Vectorization of numerical functions"))
243 #|
;; some of this goes back in, but not all of it?
244 (defpackage :lisp-stat-linalg
251 :lisp-stat-compound-data
)
252 (:shadowing-import-from
:lisp-stat-math
253 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
254 asin acos atan sinh cosh tanh asinh acosh atanh float random
255 truncate floor ceiling round minusp zerop plusp evenp oddp
256 < <= = /= >= > complex conjugate realpart imagpart phase
257 min max logand logior logxor lognot ffloor fceiling
258 ftruncate fround signum cis
)
259 (:export chol-decomp lu-decomp lu-solve determinant inverse
260 sv-decomp qr-decomp rcondest make-rotation spline
261 kernel-dens kernel-smooth
262 fft make-sweep-matrix sweep-operator ax
+y eigen
264 check-real
;; for optimize
266 covariance-matrix matrix print-matrix solve
267 backsolve eigenvalues eigenvectors accumulate cumsum combine
275 (defpackage :lisp-stat-data
276 (:documentation
"Data management, integration, I/O, and other data technologies.")
277 (:nicknames
:ls-data
)
279 :lisp-stat-object-system
282 :lisp-stat-compound-data
)
283 (:shadowing-import-from
:lisp-stat-object-system
284 call-method call-next-method
)
285 (:export open-file-dialog read-data-file read-data-columns load-data
286 load-example
*variables
* *ask-on-redefine
*
287 def variables savevar undef
))
289 (defpackage :lisp-stat-descriptive-statistics
293 :lisp-stat-compound-data
296 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
297 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
298 asin acos atan sinh cosh tanh asinh acosh atanh float random
299 truncate floor ceiling round minusp zerop plusp evenp oddp
300 < <= = /= >= > ;; complex
301 conjugate realpart imagpart phase
302 min max logand logior logxor lognot ffloor fceiling
303 ftruncate fround signum cis
)
304 (:export standard-deviation
305 quantile median interquartile-range
309 (defpackage :lisp-stat-regression-linear
313 :lisp-stat-compound-data
314 :lisp-stat-descriptive-statistics
)
315 (:shadowing-import-from
:lisp-stat-object-system
316 call-method call-next-method
)
317 (:export regression-model fit-model
319 estimates covariance-matrix
320 ;; functions for helpers
322 print-object
;; for method dispatch
325 (defpackage :common-lisp-statistics
326 (:documentation
"Experimentation package for LispStat. Serious work
327 should be packaged up elsewhere for reproducibility. By this I
328 mean, creating a data/analytics/analysis package with the minimal
329 set of objects required.")
330 (:nicknames
:cls
:common-lisp-statistics
:lisp-stat
)
333 :lisp-stat-object-system
334 :lisp-stat-compound-data
335 :lisp-stat-probability
343 :lisp-matrix
;; conversion to a more robust linalg approach
344 :lisp-stat-descriptive-statistics
345 :lisp-stat-regression-linear
348 ;; :cls-visualize-plplot
350 (:shadowing-import-from
:lisp-stat-object-system
351 call-method call-next-method
)
352 (:shadowing-import-from
:lisp-stat-math
353 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
354 asin acos atan sinh cosh tanh asinh acosh atanh float random
355 truncate floor ceiling round minusp zerop plusp evenp oddp
358 conjugate realpart imagpart phase
361 logand logior logxor lognot
362 ffloor fceiling ftruncate fround
366 *default-path
* *lsos-files
* *basic-files
* *ls-files
*
367 *lispstat-home-dir
* *lispstat-data-dir
* *lispstat-examples-dir
*
371 defmeth send proto-slot-value
374 fixnump check-nonneg-fixnum check-one-fixnum
375 check-one-nonneg-fixnum
376 check-one-real check-one-number
384 compound-data-p
*compound-data-proto
* compound-object-p
385 compound-data-seq compound-data-length
386 element-list element-seq
388 recursive-map-elements map-elements
391 get-next-element make-next-element set-next-element
399 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
400 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
401 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
403 conjugate realpart imagpart phase min max
404 logand logior logxor lognot ffloor fceiling ftruncate fround
407 #|
;; The following need to be re-found in lisp-matrix...
410 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
411 column-list inner-product outer-product cross-product transpose
412 bind-columns bind-rows
415 chol-decomp lu-decomp lu-solve determinant inverse
416 sv-decomp qr-decomp rcondest make-rotation spline
417 kernel-dens kernel-smooth
418 fft make-sweep-matrix sweep-operator ax
+y eigen
420 covariance-matrix matrix print-matrix solve
421 backsolve eigenvalues eigenvectors accumulate cumsum combine
424 ;; in linalg.lisp, possibly not supported by matlisp
425 spline kernel-dens kernel-smooth
433 make-rv-function make-rv-function-1
436 xref xtype xdims xdim xdims
*
439 open-file-dialog read-data-file read-data-columns load-data
440 load-example
*variables
* *ask-on-redefine
*
441 def variables savevar undef
444 dataframe-like dataframe-array make-dataframe
445 varlabels caselabels nrows ncols
446 dataframe-dimension dataframe-dimensons
447 dfref dfref-case dfref-var
448 consistent-dataframe-p
449 dataset list-of-columns list-of-rows
452 lists-of-same-size equal-listoflist
454 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
456 ;; statistics.lsp (descriptions, should probably be moved
458 standard-deviation quantile median interquartile-range
461 ;; probability (dists.lisp)
463 uniform-rand normal-cdf normal-quant normal-dens
464 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
465 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
466 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
467 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
468 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
469 binomial-cdf binomial-quant binomial-pmf binomial-rand
471 ;; Here is where we have a problem -- lispstat core should be core
472 ;; data management and config problems, with packages providing
473 ;; specialized extensions to LispStat, i.e. regression, nonlin
474 ;; regression, bayesian regression via laplace approximation, etc.
476 ;; The following could be considered "recommended packages",
477 ;; similar to the idea of the recommended packages in R. Probably
478 ;; we want them to do the exporting within that package, therefore
479 ;; NOT being able to lock the "data-ish" package, but only the
480 ;; subpackages prior to export.
483 ;; -- linear regressin models.
484 regression-model fit-model
485 estimates covariance-matrix
487 regression-model-proto x y intercept sweep-matrix
488 basis weights included total-sum-of-squares residual-sum-of-squares
489 predictor-names response-name case-labels
493 ;; -- nonlinear regression models
494 nreg-model nreg-model-proto mean-function theta-hat epsilon
496 ;; we might need something like xtxinv here? But should be
497 ;; encapsulated, so we use the one in regression.lisp
500 bayes-model bayes-model-proto bayes-internals
512 ;;;; PACKAGES FOR USEABILITY
514 (defpackage :lisp-stat-data-examples
515 (:documentation
"Example data for unittests, examples, illustrations,")
517 :common-lisp-statistics
)
518 (:shadowing-import-from
:lisp-stat
519 call-method call-next-method
521 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
522 asin acos atan sinh cosh tanh asinh acosh atanh float random
523 truncate floor ceiling round minusp zerop plusp evenp oddp
524 < <= = /= >= > > ;; complex
525 conjugate realpart imagpart phase
526 min max logand logior logxor lognot ffloor fceiling
527 ftruncate fround signum cis
530 (:export iron aluminum absorbtion
534 (defpackage :lisp-stat-user
535 (:documentation
"Experimentation package for LispStat. Serious work
536 should be placed in a similar package elsewhere for
537 reproducibility. But this should hint as to what needs to be done
538 for a user- or analysis-package.")
539 (:nicknames
:ls-user
)
540 (:use
:common-lisp
; always needed for user playgrounds!
542 :common-lisp-statistics
543 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
544 (:shadowing-import-from
:lisp-stat
545 call-method call-next-method
547 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
548 asin acos atan sinh cosh tanh asinh acosh atanh float random
549 truncate floor ceiling round minusp zerop plusp evenp oddp
550 < <= = /= >= > > ;; complex
551 conjugate realpart imagpart phase
552 min max logand logior logxor lognot ffloor fceiling
553 ftruncate fround signum cis
557 (defpackage :lisp-stat-unittests
560 :lisp-stat
:lisp-stat-data-examples
)
561 (:shadowing-import-from
:lisp-stat
562 call-method call-next-method
;; objects
563 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
564 asin acos atan sinh cosh tanh asinh acosh atanh float random
565 truncate floor ceiling round minusp zerop plusp evenp oddp
566 < <= = /= >= > ;; complex
567 conjugate realpart imagpart phase
568 min max logand logior logxor lognot ffloor fceiling
569 ftruncate fround signum cis
)
570 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
571 almost
= almost
=lists numerical
=)) ; compare
573 (defpackage :cls-dataframe-example
575 :lift
:lisp-stat-unittests
576 :lisp-stat-data-examples
578 (:export absorbtion aluminum iron
))
581 (defpackage :lisp-stat-optimize
586 :lisp-stat-object-system
588 :lisp-stat-compound-data
594 :lisp-stat-linalg-data
598 (:shadowing-import-from
:lisp-stat-object-system
599 call-method call-next-method
)
600 (:shadowing-import-from
:lisp-stat-math
601 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
602 asin acos atan sinh cosh tanh asinh acosh atanh float random
603 truncate floor ceiling round minusp zerop plusp evenp oddp
604 < <= = /= >= > complex conjugate realpart imagpart phase
605 min max logand logior logxor lognot ffloor fceiling
606 ftruncate fround signum cis
)
612 newtonmax nelmeadmax
))