3 ;;; Time-stamp: <2009-04-28 23:03:22 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
171 (defpackage :cls-visualize-plplot
178 plot-ex contour-plot-ex fn-contour-plot-ex shade-plot-ex
3D-plot-ex
))
183 (defpackage :lisp-stat-ffi-int
186 (:export ccl-store-integer ccl-store-double ccl-store-ptr
189 (defpackage :lisp-stat-probability
194 (:export log-gamma set-seed
196 normal-cdf normal-quant normal-dens normal-rand
198 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
199 gamma-cdf gamma-quant gamma-dens gamma-rand
200 chisq-cdf chisq-quant chisq-dens chisq-rand
201 beta-cdf beta-quant beta-dens beta-rand
202 t-cdf t-quant t-dens t-rand
203 f-cdf f-quant f-dens f-rand
204 poisson-cdf poisson-quant poisson-pmf poisson-rand
205 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
209 (defpackage :lisp-stat-math
211 :lisp-stat-object-system
213 :lisp-stat-compound-data
215 (:shadowing-import-from
:lisp-stat-object-system
216 call-method call-next-method
)
217 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
218 asin acos atan sinh cosh tanh asinh acosh atanh float random
219 truncate floor ceiling round minusp zerop plusp evenp oddp
220 < <= = /= >= > ;; complex
221 conjugate realpart imagpart phase
222 min max logand logior logxor lognot ffloor fceiling
223 ftruncate fround signum cis
)
224 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
225 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
226 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
228 conjugate realpart imagpart phase min max
229 logand logior logxor lognot ffloor fceiling ftruncate fround
231 (:documentation
"Vectorization of numerical functions"))
234 #|
;; some of this goes back in, but not all of it?
235 (defpackage :lisp-stat-linalg
242 :lisp-stat-compound-data
)
243 (:shadowing-import-from
:lisp-stat-math
244 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
245 asin acos atan sinh cosh tanh asinh acosh atanh float random
246 truncate floor ceiling round minusp zerop plusp evenp oddp
247 < <= = /= >= > complex conjugate realpart imagpart phase
248 min max logand logior logxor lognot ffloor fceiling
249 ftruncate fround signum cis
)
250 (:export chol-decomp lu-decomp lu-solve determinant inverse
251 sv-decomp qr-decomp rcondest make-rotation spline
252 kernel-dens kernel-smooth
253 fft make-sweep-matrix sweep-operator ax
+y eigen
255 check-real
;; for optimize
257 covariance-matrix matrix print-matrix solve
258 backsolve eigenvalues eigenvectors accumulate cumsum combine
266 (defpackage :lisp-stat-data
267 (:documentation
"Data management, integration, I/O, and other data technologies.")
268 (:nicknames
:ls-data
)
270 :lisp-stat-object-system
273 :lisp-stat-compound-data
)
274 (:shadowing-import-from
:lisp-stat-object-system
275 call-method call-next-method
)
276 (:export open-file-dialog read-data-file read-data-columns load-data
277 load-example
*variables
* *ask-on-redefine
*
278 def variables savevar undef
))
280 (defpackage :lisp-stat-descriptive-statistics
284 :lisp-stat-compound-data
287 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
288 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
289 asin acos atan sinh cosh tanh asinh acosh atanh float random
290 truncate floor ceiling round minusp zerop plusp evenp oddp
291 < <= = /= >= > ;; complex
292 conjugate realpart imagpart phase
293 min max logand logior logxor lognot ffloor fceiling
294 ftruncate fround signum cis
)
295 (:export standard-deviation
296 quantile median interquartile-range
300 (defpackage :lisp-stat-regression-linear
304 :lisp-stat-compound-data
305 :lisp-stat-descriptive-statistics
)
306 (:shadowing-import-from
:lisp-stat-object-system
307 call-method call-next-method
)
308 (:export regression-model fit-model
310 estimates covariance-matrix
311 ;; functions for helpers
313 print-object
;; for method dispatch
316 (defpackage :lisp-stat
317 (:documentation
"Experimentation package for LispStat. Serious
318 work should be packaged up elsewhere for reproducibility. By this
319 I mean, creating a data/analytics/analysis package with the
320 minimal set of objects required.")
322 :lisp-stat-object-system
323 :lisp-stat-compound-data
324 :lisp-stat-probability
332 :lisp-matrix
;; conversion to a more robust linalg approach
333 :lisp-stat-descriptive-statistics
334 :lisp-stat-regression-linear
337 :cls-visualize-plplot
)
338 (:shadowing-import-from
:lisp-stat-object-system
339 call-method call-next-method
)
340 (:shadowing-import-from
:lisp-stat-math
341 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
342 asin acos atan sinh cosh tanh asinh acosh atanh float random
343 truncate floor ceiling round minusp zerop plusp evenp oddp
346 conjugate realpart imagpart phase
349 logand logior logxor lognot
350 ffloor fceiling ftruncate fround
359 fixnump check-nonneg-fixnum check-one-fixnum
360 check-one-nonneg-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
392 #|
;; 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
426 dataframe-like dataframe-array make-dataframe
427 varlabels caselabels nrows ncols
428 dataframe-dimension dataframe-dimensons
429 dfref dfref-case dfref-var
430 consistent-dataframe-p
432 list-of-columns list-of-rows
435 lists-of-same-size equal-listoflist
437 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
439 ;; statistics.lsp (descriptions, should probably be moved
441 standard-deviation quantile median interquartile-range
444 ;; probability (dists.lisp)
446 uniform-rand normal-cdf normal-quant normal-dens
447 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
448 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
449 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
450 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
451 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
452 binomial-cdf binomial-quant binomial-pmf binomial-rand
454 ;; Here is where we have a problem -- lispstat core should be core
455 ;; data management and config problems, with packages providing
456 ;; specialized extensions to LispStat, i.e. regression, nonlin
457 ;; regression, bayesian regression via laplace approximation, etc.
459 ;; The following could be considered "recommended packages",
460 ;; similar to the idea of the recommended packages in R. Probably
461 ;; we want them to do the exporting within that package, therefore
462 ;; NOT being able to lock the "data-ish" package, but only the
463 ;; subpackages prior to export.
466 ;; -- linear regressin models.
467 regression-model fit-model
468 estimates covariance-matrix
470 regression-model-proto x y intercept sweep-matrix
471 basis weights included total-sum-of-squares residual-sum-of-squares
472 predictor-names response-name case-labels
476 ;; -- nonlinear regression models
477 nreg-model nreg-model-proto mean-function theta-hat epsilon
479 ;; we might need something like xtxinv here? But should be
480 ;; encapsulated, so we use the one in regression.lisp
483 bayes-model bayes-model-proto bayes-internals
495 ;;;; PACKAGES FOR USEABILITY
497 (defpackage :lisp-stat-data-examples
498 (:documentation
"Example data for unittests, examples, illustrations,")
501 (:shadowing-import-from
:lisp-stat
502 call-method call-next-method
504 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
505 asin acos atan sinh cosh tanh asinh acosh atanh float random
506 truncate floor ceiling round minusp zerop plusp evenp oddp
507 < <= = /= >= > > ;; complex
508 conjugate realpart imagpart phase
509 min max logand logior logxor lognot ffloor fceiling
510 ftruncate fround signum cis
513 (:export iron aluminum absorbtion
517 (defpackage :lisp-stat-user
518 (:documentation
"Experimentation package for LispStat.
519 Serious work should be placed in a similar package elsewhere for
520 reproducibility. But this should hint as to what needs to be
521 done for a user- or analysis-package.")
522 (:nicknames
:ls-user
)
526 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
527 (:shadowing-import-from
:lisp-stat
528 call-method call-next-method
530 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
531 asin acos atan sinh cosh tanh asinh acosh atanh float random
532 truncate floor ceiling round minusp zerop plusp evenp oddp
533 < <= = /= >= > > ;; complex
534 conjugate realpart imagpart phase
535 min max logand logior logxor lognot ffloor fceiling
536 ftruncate fround signum cis
540 (defpackage :lisp-stat-unittests
543 :lisp-stat
:lisp-stat-data-examples
)
544 (:shadowing-import-from
:lisp-stat
545 call-method call-next-method
;; objects
546 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
547 asin acos atan sinh cosh tanh asinh acosh atanh float random
548 truncate floor ceiling round minusp zerop plusp evenp oddp
549 < <= = /= >= > ;; complex
550 conjugate realpart imagpart phase
551 min max logand logior logxor lognot ffloor fceiling
552 ftruncate fround signum cis
)
553 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
554 almost
= almost
=lists numerical
=)) ; compare
556 (defpackage :cls-dataframe-example
558 :lift
:lisp-stat-unittests
559 :lisp-stat-data-examples
561 (:export absorbtion aluminum iron
))
564 (defpackage :lisp-stat-optimize
569 :lisp-stat-object-system
571 :lisp-stat-compound-data
577 :lisp-stat-linalg-data
581 (:shadowing-import-from
:lisp-stat-object-system
582 call-method call-next-method
)
583 (:shadowing-import-from
:lisp-stat-math
584 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
585 asin acos atan sinh cosh tanh asinh acosh atanh float random
586 truncate floor ceiling round minusp zerop plusp evenp oddp
587 < <= = /= >= > complex conjugate realpart imagpart phase
588 min max logand logior logxor lognot ffloor fceiling
589 ftruncate fround signum cis
)
595 newtonmax nelmeadmax
))