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
))
146 (defpackage :lisp-stat-model
147 (:documentation
"Model management for data analysis.")
151 ;; data structures for model and model/data combination
152 model statistical-model analysis
))
155 (defpackage :lisp-stat-regression-linear-clos
158 :lisp-stat-dataframe
)
159 (:export regression-model
))
162 (defpackage :cls-visualize
165 :lisp-stat-dataframe
))
167 (defpackage :cls-visualize-plplot
182 (defpackage :lisp-stat-ffi-int
185 (:export ccl-store-integer ccl-store-double ccl-store-ptr
188 (defpackage :lisp-stat-probability
193 (:export log-gamma set-seed
195 normal-cdf normal-quant normal-dens normal-rand
197 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
198 gamma-cdf gamma-quant gamma-dens gamma-rand
199 chisq-cdf chisq-quant chisq-dens chisq-rand
200 beta-cdf beta-quant beta-dens beta-rand
201 t-cdf t-quant t-dens t-rand
202 f-cdf f-quant f-dens f-rand
203 poisson-cdf poisson-quant poisson-pmf poisson-rand
204 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
208 (defpackage :lisp-stat-math
210 :lisp-stat-object-system
212 :lisp-stat-compound-data
214 (:shadowing-import-from
:lisp-stat-object-system
215 call-method call-next-method
)
216 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
217 asin acos atan sinh cosh tanh asinh acosh atanh float random
218 truncate floor ceiling round minusp zerop plusp evenp oddp
219 < <= = /= >= > ;; complex
220 conjugate realpart imagpart phase
221 min max logand logior logxor lognot ffloor fceiling
222 ftruncate fround signum cis
)
223 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
224 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
225 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
227 conjugate realpart imagpart phase min max
228 logand logior logxor lognot ffloor fceiling ftruncate fround
230 (:documentation
"Vectorization of numerical functions"))
233 #|
;; some of this goes back in, but not all of it?
234 (defpackage :lisp-stat-linalg
241 :lisp-stat-compound-data
)
242 (:shadowing-import-from
:lisp-stat-math
243 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
244 asin acos atan sinh cosh tanh asinh acosh atanh float random
245 truncate floor ceiling round minusp zerop plusp evenp oddp
246 < <= = /= >= > complex conjugate realpart imagpart phase
247 min max logand logior logxor lognot ffloor fceiling
248 ftruncate fround signum cis
)
249 (:export chol-decomp lu-decomp lu-solve determinant inverse
250 sv-decomp qr-decomp rcondest make-rotation spline
251 kernel-dens kernel-smooth
252 fft make-sweep-matrix sweep-operator ax
+y eigen
254 check-real
;; for optimize
256 covariance-matrix matrix print-matrix solve
257 backsolve eigenvalues eigenvectors accumulate cumsum combine
265 (defpackage :lisp-stat-data
266 (:documentation
"Data management, integration, I/O, and other data technologies.")
267 (:nicknames
:ls-data
)
269 :lisp-stat-object-system
272 :lisp-stat-compound-data
)
273 (:shadowing-import-from
:lisp-stat-object-system
274 call-method call-next-method
)
275 (:export open-file-dialog read-data-file read-data-columns load-data
276 load-example
*variables
* *ask-on-redefine
*
277 def variables savevar undef
))
279 (defpackage :lisp-stat-descriptive-statistics
283 :lisp-stat-compound-data
286 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
287 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
288 asin acos atan sinh cosh tanh asinh acosh atanh float random
289 truncate floor ceiling round minusp zerop plusp evenp oddp
290 < <= = /= >= > ;; complex
291 conjugate realpart imagpart phase
292 min max logand logior logxor lognot ffloor fceiling
293 ftruncate fround signum cis
)
294 (:export standard-deviation
295 quantile median interquartile-range
299 (defpackage :lisp-stat-regression-linear
302 :lisp-stat-object-system
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
317 regression-model-proto x y intercept
319 basis weights included
320 total-sum-of-squares residual-sum-of-squares
321 predictor-names response-name case-labels
324 (defpackage :lisp-stat
325 (:documentation
"Experimentation package for LispStat. Serious
326 work should be packaged up elsewhere for reproducibility. By this
327 I mean, creating a data/analytics/analysis package with the
328 minimal set of objects required.")
330 :lisp-stat-object-system
331 :lisp-stat-compound-data
332 :lisp-stat-probability
340 :lisp-matrix
;; conversion to a more robust linalg approach
341 :lisp-stat-descriptive-statistics
342 :lisp-stat-regression-linear
345 :cls-visualize-plplot
)
346 (:shadowing-import-from
:lisp-stat-object-system
347 call-method call-next-method
)
348 (:shadowing-import-from
:lisp-stat-math
349 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
350 asin acos atan sinh cosh tanh asinh acosh atanh float random
351 truncate floor ceiling round minusp zerop plusp evenp oddp
354 conjugate realpart imagpart phase
357 logand logior logxor lognot
358 ffloor fceiling ftruncate fround
367 fixnump check-nonneg-fixnum check-one-fixnum
368 check-one-nonneg-fixnum
369 check-one-real check-one-number
377 compound-data-p
*compound-data-proto
* compound-object-p
378 compound-data-seq compound-data-length
379 element-list element-seq
381 recursive-map-elements map-elements
384 get-next-element make-next-element set-next-element
392 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
393 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
394 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
396 conjugate realpart imagpart phase min max
397 logand logior logxor lognot ffloor fceiling ftruncate fround
400 #|
;; The following need to be re-found in lisp-matrix...
403 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
404 column-list inner-product outer-product cross-product transpose
405 bind-columns bind-rows
408 chol-decomp lu-decomp lu-solve determinant inverse
409 sv-decomp qr-decomp rcondest make-rotation spline
410 kernel-dens kernel-smooth
411 fft make-sweep-matrix sweep-operator ax
+y eigen
413 covariance-matrix matrix print-matrix solve
414 backsolve eigenvalues eigenvectors accumulate cumsum combine
417 ;; in linalg.lisp, possibly not supported by matlisp
418 spline kernel-dens kernel-smooth
426 make-rv-function make-rv-function-1
429 open-file-dialog read-data-file read-data-columns load-data
430 load-example
*variables
* *ask-on-redefine
*
431 def variables savevar undef
434 dataframe-like dataframe-array make-dataframe
435 varlabels caselabels nrows ncols
436 dataframe-dimension dataframe-dimensons
437 dfref dfref-case dfref-var
438 consistent-dataframe-p
440 list-of-columns list-of-rows
443 lists-of-same-size equal-listoflist
445 listoflist-
>dataframe listoflist-
>array listoflist-
>matrix-like
447 ;; statistics.lsp (descriptions, should probably be moved
449 standard-deviation quantile median interquartile-range
452 ;; probability (dists.lisp)
454 uniform-rand normal-cdf normal-quant normal-dens
455 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
456 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
457 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
458 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
459 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
460 binomial-cdf binomial-quant binomial-pmf binomial-rand
462 ;; Here is where we have a problem -- lispstat core should be core
463 ;; data management and config problems, with packages providing
464 ;; specialized extensions to LispStat, i.e. regression, nonlin
465 ;; regression, bayesian regression via laplace approximation, etc.
467 ;; The following could be considered "recommended packages",
468 ;; similar to the idea of the recommended packages in R. Probably
469 ;; we want them to do the exporting within that package, therefore
470 ;; NOT being able to lock the "data-ish" package, but only the
471 ;; subpackages prior to export.
474 ;; -- linear regressin models.
475 regression-model fit-model
476 estimates covariance-matrix
478 regression-model-proto x y intercept sweep-matrix
479 basis weights included total-sum-of-squares residual-sum-of-squares
480 predictor-names response-name case-labels
484 ;; -- nonlinear regression models
485 nreg-model nreg-model-proto mean-function theta-hat epsilon
487 ;; we might need something like xtxinv here? But should be
488 ;; encapsulated, so we use the one in regression.lisp
491 bayes-model bayes-model-proto bayes-internals
503 ;;;; PACKAGES FOR USEABILITY
505 (defpackage :lisp-stat-data-examples
506 (:documentation
"Example data for unittests, examples, illustrations,")
509 (:shadowing-import-from
:lisp-stat
510 call-method call-next-method
512 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
513 asin acos atan sinh cosh tanh asinh acosh atanh float random
514 truncate floor ceiling round minusp zerop plusp evenp oddp
515 < <= = /= >= > > ;; complex
516 conjugate realpart imagpart phase
517 min max logand logior logxor lognot ffloor fceiling
518 ftruncate fround signum cis
521 (:export iron aluminum absorbtion
525 (defpackage :lisp-stat-user
526 (:documentation
"Experimentation package for LispStat.
527 Serious work should be placed in a similar package elsewhere for
528 reproducibility. But this should hint as to what needs to be
529 done for a user- or analysis-package.")
530 (:nicknames
:ls-user
)
534 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
535 (:shadowing-import-from
:lisp-stat
536 call-method call-next-method
538 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
539 asin acos atan sinh cosh tanh asinh acosh atanh float random
540 truncate floor ceiling round minusp zerop plusp evenp oddp
541 < <= = /= >= > > ;; complex
542 conjugate realpart imagpart phase
543 min max logand logior logxor lognot ffloor fceiling
544 ftruncate fround signum cis
548 (defpackage :lisp-stat-unittests
551 :lisp-stat
:lisp-stat-data-examples
)
552 (:shadowing-import-from
:lisp-stat
553 call-method call-next-method
;; objects
554 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
555 asin acos atan sinh cosh tanh asinh acosh atanh float random
556 truncate floor ceiling round minusp zerop plusp evenp oddp
557 < <= = /= >= > ;; complex
558 conjugate realpart imagpart phase
559 min max logand logior logxor lognot ffloor fceiling
560 ftruncate fround signum cis
)
561 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
562 almost
= almost
=lists numerical
=)) ; compare
564 (defpackage :lisp-stat-dataframe-example
566 :lift
:lisp-stat-unittests
567 :lisp-stat-data-examples
568 :lisp-stat-dataframe
)
569 (:export absorbtion aluminum iron
))
572 (defpackage :lisp-stat-optimize
577 :lisp-stat-object-system
579 :lisp-stat-compound-data
585 :lisp-stat-linalg-data
589 (:shadowing-import-from
:lisp-stat-object-system
590 call-method call-next-method
)
591 (:shadowing-import-from
:lisp-stat-math
592 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
593 asin acos atan sinh cosh tanh asinh acosh atanh float random
594 truncate floor ceiling round minusp zerop plusp evenp oddp
595 < <= = /= >= > complex conjugate realpart imagpart phase
596 min max logand logior logxor lognot ffloor fceiling
597 ftruncate fround signum cis
)
603 newtonmax nelmeadmax
))