3 ;;; Time-stamp: <2009-04-17 18:23:10 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
23 (defpackage :lisp-stat-object-system
24 (:nicknames
:ls-objects
:lsos
)
26 (:shadow
:call-method
:call-next-method
)
27 (:export ls-object objectp
*object
* kind-of-p make-object
29 *set-slot-hook
* proto-slot-value self
30 send call-next-method call-method
31 defmeth defproto instance-slots proto-name
))
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 (defpackage :lisp-stat-compound-data
56 :lisp-stat-object-system
58 (:shadowing-import-from
:lisp-stat-object-system
59 call-next-method call-method
)
60 (:export compound-data-p
*compound-data-proto
*
62 compound-data-seq compound-data-length
63 element-list element-seq
65 recursive-map-elements map-elements repeat
67 get-next-element make-next-element set-next-element
70 select split-list which
74 (defpackage :lisp-stat-macros
76 :lisp-stat-compound-data
)
77 (:export make-rv-function make-rv-function-1
))
79 (defpackage :lisp-stat-basics
81 :lisp-stat-object-system
85 :lisp-stat-compound-data
)
86 (:shadowing-import-from
:lisp-stat-object-system
87 call-method call-next-method
)
88 (:export permute-array sum prod count-elements mean
91 (defpackage :lisp-stat-float
93 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
94 machine-epsilon base-float makedouble
96 make-base-trans-fun-2 make-base-trans-fun
98 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
99 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
100 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
101 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
102 BASE-FROUND BASE-SIGNUM BASE-CIS
))
104 (defpackage :lisp-stat-macros
106 :lisp-stat-compound-data
)
107 (:export make-rv-function make-rv-function-1
))
109 ;;; NEW CLOS STRUCTURE
113 (defpackage :lisp-stat-dataframe
117 ;; generic container class for data -- if small enough
118 ;; could be value, otherwise might be reference.
124 varlabels caselabels nrows ncols
125 dataframe-dimension dataframe-dimensons
126 dfref dfref-case dfref-var
127 consistent-dataframe-p
130 list-of-columns
;; list-of-variables
131 list-of-rows
;; list-of-observations
135 (defpackage :cls-data-listoflist
138 :lisp-stat-dataframe
) ; for dataframe
139 (:export lists-of-same-size
142 listoflist-
>dataframe
144 listoflist-
>matrix-like
))
147 (defpackage :cls-dataimport
148 (:documentation
"Data I/O and similar import technologies.")
150 :lisp-stat-object-system
154 (:shadowing-import-from
:lisp-stat-object-system
155 call-method call-next-method
)
156 (:export dsvstream-
>dataframe dsvstream-
>matrix dsvstream-
>listoflist
))
159 (defpackage :lisp-stat-model
160 (:documentation
"Model management for data analysis.")
164 ;; data structures for model and model/data combination
165 model statistical-model analysis
))
168 (defpackage :lisp-stat-regression-linear-clos
171 :lisp-stat-dataframe
)
172 (:export regression-model
))
175 (defpackage :cls-visualize
178 :lisp-stat-dataframe
))
180 (defpackage :cls-visualize-plplot
195 (defpackage :lisp-stat-ffi-int
198 (:export ccl-store-integer ccl-store-double ccl-store-ptr
201 (defpackage :lisp-stat-probability
206 (:export log-gamma set-seed
208 normal-cdf normal-quant normal-dens normal-rand
210 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
211 gamma-cdf gamma-quant gamma-dens gamma-rand
212 chisq-cdf chisq-quant chisq-dens chisq-rand
213 beta-cdf beta-quant beta-dens beta-rand
214 t-cdf t-quant t-dens t-rand
215 f-cdf f-quant f-dens f-rand
216 poisson-cdf poisson-quant poisson-pmf poisson-rand
217 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
221 (defpackage :lisp-stat-math
223 :lisp-stat-object-system
225 :lisp-stat-compound-data
227 (:shadowing-import-from
:lisp-stat-object-system
228 call-method call-next-method
)
229 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
230 asin acos atan sinh cosh tanh asinh acosh atanh float random
231 truncate floor ceiling round minusp zerop plusp evenp oddp
232 < <= = /= >= > ;; complex
233 conjugate realpart imagpart phase
234 min max logand logior logxor lognot ffloor fceiling
235 ftruncate fround signum cis
)
236 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
237 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
238 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
240 conjugate realpart imagpart phase min max
241 logand logior logxor lognot ffloor fceiling ftruncate fround
243 (:documentation
"Vectorization of numerical functions"))
246 #|
;; some of this goes back in, but not all of it?
247 (defpackage :lisp-stat-linalg
254 :lisp-stat-compound-data
)
255 (:shadowing-import-from
:lisp-stat-math
256 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
257 asin acos atan sinh cosh tanh asinh acosh atanh float random
258 truncate floor ceiling round minusp zerop plusp evenp oddp
259 < <= = /= >= > complex conjugate realpart imagpart phase
260 min max logand logior logxor lognot ffloor fceiling
261 ftruncate fround signum cis
)
262 (:export chol-decomp lu-decomp lu-solve determinant inverse
263 sv-decomp qr-decomp rcondest make-rotation spline
264 kernel-dens kernel-smooth
265 fft make-sweep-matrix sweep-operator ax
+y eigen
267 check-real
;; for optimize
269 covariance-matrix matrix print-matrix solve
270 backsolve eigenvalues eigenvectors accumulate cumsum combine
278 (defpackage :lisp-stat-data
279 (:documentation
"Data management, integration, I/O, and other data technologies.")
280 (:nicknames
:ls-data
)
282 :lisp-stat-object-system
285 :lisp-stat-compound-data
)
286 (:shadowing-import-from
:lisp-stat-object-system
287 call-method call-next-method
)
288 (:export open-file-dialog read-data-file read-data-columns load-data
289 load-example
*variables
* *ask-on-redefine
*
290 def variables savevar undef
))
292 (defpackage :lisp-stat-descriptive-statistics
296 :lisp-stat-compound-data
299 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
300 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
301 asin acos atan sinh cosh tanh asinh acosh atanh float random
302 truncate floor ceiling round minusp zerop plusp evenp oddp
303 < <= = /= >= > ;; complex
304 conjugate realpart imagpart phase
305 min max logand logior logxor lognot ffloor fceiling
306 ftruncate fround signum cis
)
307 (:export standard-deviation
308 quantile median interquartile-range
312 (defpackage :lisp-stat-regression-linear
315 :lisp-stat-object-system
317 :lisp-stat-compound-data
318 :lisp-stat-descriptive-statistics
)
319 (:shadowing-import-from
:lisp-stat-object-system
320 call-method call-next-method
)
321 (:export regression-model fit-model
323 estimates covariance-matrix
324 ;; functions for helpers
326 print-object
;; for method dispatch
330 regression-model-proto x y intercept
332 basis weights included
333 total-sum-of-squares residual-sum-of-squares
334 predictor-names response-name case-labels
337 (defpackage :lisp-stat
338 (:documentation
"Experimentation package for LispStat. Serious
339 work should be packaged up elsewhere for reproducibility. By this
340 I mean, creating a data/analytics/analysis package with the
341 minimal set of objects required.")
343 :lisp-stat-object-system
344 :lisp-stat-compound-data
345 :lisp-stat-probability
353 :lisp-matrix
;; conversion to a more robust linalg approach
354 :lisp-stat-descriptive-statistics
355 :lisp-stat-regression-linear
358 :cls-visualize-plplot
)
359 (:shadowing-import-from
:lisp-stat-object-system
360 call-method call-next-method
)
361 (:shadowing-import-from
:lisp-stat-math
362 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
363 asin acos atan sinh cosh tanh asinh acosh atanh float random
364 truncate floor ceiling round minusp zerop plusp evenp oddp
367 conjugate realpart imagpart phase
370 logand logior logxor lognot
371 ffloor fceiling ftruncate fround
380 fixnump check-nonneg-fixnum check-one-fixnum
381 check-one-nonneg-fixnum
382 check-one-real check-one-number
390 compound-data-p
*compound-data-proto
* compound-object-p
391 compound-data-seq compound-data-length
392 element-list element-seq
394 recursive-map-elements map-elements
397 get-next-element make-next-element set-next-element
405 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
406 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
407 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
409 conjugate realpart imagpart phase min max
410 logand logior logxor lognot ffloor fceiling ftruncate fround
413 #|
;; The following need to be re-found in lisp-matrix...
416 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
417 column-list inner-product outer-product cross-product transpose
418 bind-columns bind-rows
421 chol-decomp lu-decomp lu-solve determinant inverse
422 sv-decomp qr-decomp rcondest make-rotation spline
423 kernel-dens kernel-smooth
424 fft make-sweep-matrix sweep-operator ax
+y eigen
426 covariance-matrix matrix print-matrix solve
427 backsolve eigenvalues eigenvectors accumulate cumsum combine
430 ;; in linalg.lisp, possibly not supported by matlisp
431 spline kernel-dens kernel-smooth
439 make-rv-function make-rv-function-1
442 open-file-dialog read-data-file read-data-columns load-data
443 load-example
*variables
* *ask-on-redefine
*
444 def variables savevar undef
447 dataframe-like dataframe-array make-dataframe
448 varlabels caselabels nrows ncols
449 dataframe-dimension dataframe-dimensons
450 dfref dfref-case dfref-var
451 consistent-dataframe-p
453 list-of-columns list-of-rows
456 lists-of-same-size equal-listoflist
458 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
460 ;; statistics.lsp (descriptions, should probably be moved
462 standard-deviation quantile median interquartile-range
465 ;; probability (dists.lisp)
467 uniform-rand normal-cdf normal-quant normal-dens
468 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
469 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
470 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
471 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
472 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
473 binomial-cdf binomial-quant binomial-pmf binomial-rand
475 ;; Here is where we have a problem -- lispstat core should be core
476 ;; data management and config problems, with packages providing
477 ;; specialized extensions to LispStat, i.e. regression, nonlin
478 ;; regression, bayesian regression via laplace approximation, etc.
480 ;; The following could be considered "recommended packages",
481 ;; similar to the idea of the recommended packages in R. Probably
482 ;; we want them to do the exporting within that package, therefore
483 ;; NOT being able to lock the "data-ish" package, but only the
484 ;; subpackages prior to export.
487 ;; -- linear regressin models.
488 regression-model fit-model
489 estimates covariance-matrix
491 regression-model-proto x y intercept sweep-matrix
492 basis weights included total-sum-of-squares residual-sum-of-squares
493 predictor-names response-name case-labels
497 ;; -- nonlinear regression models
498 nreg-model nreg-model-proto mean-function theta-hat epsilon
500 ;; we might need something like xtxinv here? But should be
501 ;; encapsulated, so we use the one in regression.lisp
504 bayes-model bayes-model-proto bayes-internals
516 ;;;; PACKAGES FOR USEABILITY
518 (defpackage :lisp-stat-data-examples
519 (:documentation
"Example data for unittests, examples, illustrations,")
522 (:shadowing-import-from
:lisp-stat
523 call-method call-next-method
525 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
526 asin acos atan sinh cosh tanh asinh acosh atanh float random
527 truncate floor ceiling round minusp zerop plusp evenp oddp
528 < <= = /= >= > > ;; complex
529 conjugate realpart imagpart phase
530 min max logand logior logxor lognot ffloor fceiling
531 ftruncate fround signum cis
534 (:export iron aluminum absorbtion
538 (defpackage :lisp-stat-user
539 (:documentation
"Experimentation package for LispStat.
540 Serious work should be placed in a similar package elsewhere for
541 reproducibility. But this should hint as to what needs to be
542 done for a user- or analysis-package.")
543 (:nicknames
:ls-user
)
547 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
548 (:shadowing-import-from
:lisp-stat
549 call-method call-next-method
551 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
552 asin acos atan sinh cosh tanh asinh acosh atanh float random
553 truncate floor ceiling round minusp zerop plusp evenp oddp
554 < <= = /= >= > > ;; complex
555 conjugate realpart imagpart phase
556 min max logand logior logxor lognot ffloor fceiling
557 ftruncate fround signum cis
561 (defpackage :lisp-stat-unittests
564 :lisp-stat
:lisp-stat-data-examples
)
565 (:shadowing-import-from
:lisp-stat
566 call-method call-next-method
;; objects
567 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
568 asin acos atan sinh cosh tanh asinh acosh atanh float random
569 truncate floor ceiling round minusp zerop plusp evenp oddp
570 < <= = /= >= > ;; complex
571 conjugate realpart imagpart phase
572 min max logand logior logxor lognot ffloor fceiling
573 ftruncate fround signum cis
)
574 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
575 almost
= almost
=lists numerical
=)) ; compare
577 (defpackage :lisp-stat-dataframe-example
579 :lift
:lisp-stat-unittests
580 :lisp-stat-data-examples
581 :lisp-stat-dataframe
)
582 (:export absorbtion aluminum iron
))
585 (defpackage :lisp-stat-optimize
590 :lisp-stat-object-system
592 :lisp-stat-compound-data
598 :lisp-stat-linalg-data
602 (:shadowing-import-from
:lisp-stat-object-system
603 call-method call-next-method
)
604 (:shadowing-import-from
:lisp-stat-math
605 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
606 asin acos atan sinh cosh tanh asinh acosh atanh float random
607 truncate floor ceiling round minusp zerop plusp evenp oddp
608 < <= = /= >= > complex conjugate realpart imagpart phase
609 min max logand logior logxor lognot ffloor fceiling
610 ftruncate fround signum cis
)
616 newtonmax nelmeadmax
))