3 ;;; Time-stamp: <2008-11-07 17:56:48 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
24 (defpackage :lisp-stat-object-system
25 (:nicknames
:ls-objects
:lsos
)
27 (:shadow
:call-method
:call-next-method
:slot-value
)
28 (:export ls-object objectp
*object
* kind-of-p make-object
30 *set-slot-hook
* slot-value self
31 send call-next-method call-method
32 defmeth defproto instance-slots proto-name
))
38 (defpackage :lisp-stat-types
39 (:documentation
"Provides some typeing for LispStat, but is clearly
43 check-nonneg-fixnum check-one-nonneg-fixnum
44 check-one-fixnum check-one-real check-one-number
))
51 (defpackage :lisp-stat-float
53 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
54 machine-epsilon base-float makedouble
56 make-base-trans-fun-2 make-base-trans-fun
58 base-log base-exp base-expt base-sqrt base-sin base-cos
59 base-tan base-asin base-acos base-atan base-sinh
60 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
61 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
62 BASE-FROUND BASE-SIGNUM BASE-CIS
))
65 (defpackage :lisp-stat-compound-data
67 :lisp-stat-object-system
69 (:shadowing-import-from
:lisp-stat-object-system
71 call-next-method call-method
)
72 (:export compound-data-p
*compound-data-proto
*
74 compound-data-seq compound-data-length
75 element-list element-seq
77 recursive-map-elements map-elements repeat
79 get-next-element make-next-element set-next-element
80 sequencep iseq ordered-nneg-seq
81 select split-list which
85 (defpackage :lisp-stat-macros
87 :lisp-stat-compound-data
)
88 (:export make-rv-function make-rv-function-1
))
90 (defpackage :lisp-stat-basics
92 :lisp-stat-object-system
96 :lisp-stat-compound-data
)
97 (:shadowing-import-from
:lisp-stat-object-system
98 slot-value call-method call-next-method
)
99 (:export permute-array sum prod count-elements mean
104 (defpackage :lisp-stat-float
106 (:export
+stat-float-typing
+ +stat-cfloat-typing
+ +stat-float-template
+
107 machine-epsilon base-float makedouble
109 make-base-trans-fun-2 make-base-trans-fun
111 BASE-LOG BASE-EXP BASE-EXPT BASE-SQRT BASE-SIN BASE-COS
112 BASE-TAN BASE-ASIN BASE-ACOS BASE-ATAN BASE-SINH
113 BASE-COSH BASE-TANH BASE-ASINH BASE-ACOSH BASE-ATANH
114 BASE-ABS BASE-PHASE BASE-FFLOOR BASE-FCEILING BASE-FTRUNCATE
115 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
))
124 ;;; NEW CLOS STRUCTURE
126 (defpackage :lisp-stat-data-clos
129 (:export get-variable-matrix get-variable-vector
130 ;; generic container class for data -- if small enough
131 ;; could be value, otherwise might be reference.
134 (defpackage :lisp-stat-regression-linear-clos
137 :lisp-stat-data-clos
)
138 (:export regression-model
))
144 (defpackage :lisp-stat-ffi-int
147 (:export ccl-store-integer ccl-store-double ccl-store-ptr
150 (defpackage :lisp-stat-probability
155 (:export log-gamma set-seed
157 normal-cdf normal-quant normal-dens normal-rand
159 cauchy-cdf cauchy-quant cauchy-dens cauchy-rand
160 gamma-cdf gamma-quant gamma-dens gamma-rand
161 chisq-cdf chisq-quant chisq-dens chisq-rand
162 beta-cdf beta-quant beta-dens beta-rand
163 t-cdf t-quant t-dens t-rand
164 f-cdf f-quant f-dens f-rand
165 poisson-cdf poisson-quant poisson-pmf poisson-rand
166 binomial-cdf binomial-quant binomial-pmf binomial-rand
))
170 (defpackage :lisp-stat-matrix
173 :lisp-stat-compound-data
)
174 (:export matrixp
;; matrix -- conflicts!
175 num-rows num-cols matmult identity-matrix diagonal
176 row-list column-list inner-product outer-product
177 cross-product transpose bind-columns bind-rows
178 array-data-vector vector-to-array
180 check-matrix check-square-matrix
182 copy-array copy-vector
185 (defpackage :lisp-stat-linalg-data
190 :lisp-stat-compound-data
192 (:export
;; more to add
193 +mode-in
+ +mode-re
+ +mode-cx
+ mode-of
195 la-data-mode la-allocate la-free
197 la-get-double la-put-double
200 la-matrix la-free-matrix la-matrix-to-data la-data-to-matrix
201 la-vector la-free-vector la-vector-to-data la-data-to-vector
))
204 (defpackage :lisp-stat-math
206 :lisp-stat-object-system
208 :lisp-stat-compound-data
210 (:shadowing-import-from
:lisp-stat-object-system
211 slot-value call-method call-next-method
)
212 (:shadow expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
213 asin acos atan sinh cosh tanh asinh acosh atanh float random
214 truncate floor ceiling round minusp zerop plusp evenp oddp
215 < <= = /= >= > ;; complex
216 conjugate realpart imagpart phase
217 min max logand logior logxor lognot ffloor fceiling
218 ftruncate fround signum cis
)
219 (:export ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
220 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
221 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
223 conjugate realpart imagpart phase min max
224 logand logior logxor lognot ffloor fceiling ftruncate fround
226 (:documentation
"Vectorization of numerical functions"))
229 (defpackage :lisp-stat-linalg
236 :lisp-stat-compound-data
237 :lisp-stat-linalg-data
239 (:shadowing-import-from
:lisp-stat-math
240 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
241 asin acos atan sinh cosh tanh asinh acosh atanh float random
242 truncate floor ceiling round minusp zerop plusp evenp oddp
243 < <= = /= >= > complex conjugate realpart imagpart phase
244 min max logand logior logxor lognot ffloor fceiling
245 ftruncate fround signum cis
)
246 (:export chol-decomp lu-decomp lu-solve determinant inverse
247 sv-decomp qr-decomp rcondest make-rotation spline
248 kernel-dens kernel-smooth
249 fft make-sweep-matrix sweep-operator ax
+y eigen
251 check-real
;; for optimize
253 covariance-matrix matrix print-matrix solve
254 backsolve eigenvalues eigenvectors accumulate cumsum combine
258 (defpackage :lisp-stat-config
260 (:export
*default-path
*
261 *lsos-files
* *basic-files
* *ls-files
*
262 *lispstat-data-dir
* *lispstat-examples-dir
*))
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 slot-value 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
285 :lisp-stat-linalg-data
288 (:shadowing-import-from
:lisp-stat-math
;; life is a vector!
289 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
290 asin acos atan sinh cosh tanh asinh acosh atanh float random
291 truncate floor ceiling round minusp zerop plusp evenp oddp
292 < <= = /= >= > ;; complex
293 conjugate realpart imagpart phase
294 min max logand logior logxor lognot ffloor fceiling
295 ftruncate fround signum cis
)
296 (:export standard-deviation quantile median interquartile-range
300 (defpackage :lisp-stat-regression-linear
302 :lisp-stat-object-system
304 :lisp-stat-compound-data
308 :lisp-stat-descriptive-statistics
)
309 (:shadowing-import-from
:lisp-stat-object-system
310 slot-value call-method call-next-method
)
311 (:shadowing-import-from
:lisp-stat-math
312 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
313 asin acos atan sinh cosh tanh asinh acosh atanh float random
314 truncate floor ceiling round minusp zerop plusp evenp oddp
315 < <= = /= >= > ;; complex
316 conjugate realpart imagpart phase
317 min max logand logior logxor lognot ffloor fceiling
318 ftruncate fround signum cis
)
319 (:export regression-model regression-model-proto x y intercept sweep-matrix
320 basis weights included 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-stat-descriptive-statistics
341 :lisp-stat-regression-linear
)
342 (:shadowing-import-from
:lisp-stat-object-system
343 slot-value call-method call-next-method
)
344 (:shadowing-import-from
:lisp-stat-math
345 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
346 asin acos atan sinh cosh tanh asinh acosh atanh float random
347 truncate floor ceiling round minusp zerop plusp evenp oddp
348 < <= = /= >= > ;;complex
349 conjugate realpart imagpart phase
350 min max logand logior logxor lognot ffloor fceiling
351 ftruncate fround signum cis
)
358 fixnump check-nonneg-fixnum check-one-fixnum
359 check-one-real check-one-number
367 compound-data-p
*compound-data-proto
* compound-object-p
368 compound-data-seq compound-data-length
369 element-list element-seq
371 recursive-map-elements map-elements
374 get-next-element make-next-element set-next-element
381 ^
** expt
+ -
* / mod rem pmin pmax abs
1+ 1- log exp sqrt sin cos
382 tan asin acos atan sinh cosh tanh asinh acosh atanh float random
383 truncate floor ceiling round minusp zerop plusp evenp oddp
< <= =
385 conjugate realpart imagpart phase min max
386 logand logior logxor lognot ffloor fceiling ftruncate fround
390 matrixp num-rows num-cols matmult identity-matrix diagonal row-list
391 column-list inner-product outer-product cross-product transpose
392 bind-columns bind-rows
395 chol-decomp lu-decomp lu-solve determinant inverse
396 sv-decomp qr-decomp rcondest make-rotation spline
397 kernel-dens kernel-smooth
398 fft make-sweep-matrix sweep-operator ax
+y eigen
400 covariance-matrix matrix print-matrix solve
401 backsolve eigenvalues eigenvectors accumulate cumsum combine
404 ;; in linalg.lisp, possibly not supported by matlisp
405 spline kernel-dens kernel-smooth
411 make-rv-function make-rv-function-1
414 open-file-dialog read-data-file read-data-columns load-data
415 load-example
*variables
* *ask-on-redefine
*
416 def variables savevar undef
419 standard-deviation quantile median interquartile-range
424 uniform-rand normal-cdf normal-quant normal-dens
425 normal-rand bivnorm-cdf cauchy-cdf cauchy-quant cauchy-dens
426 cauchy-rand gamma-cdf gamma-quant gamma-dens gamma-rand
427 chisq-cdf chisq-quant chisq-dens chisq-rand beta-cdf beta-quant
428 beta-dens beta-rand t-cdf t-quant t-dens t-rand f-cdf f-quant
429 f-dens f-rand poisson-cdf poisson-quant poisson-pmf poisson-rand
430 binomial-cdf binomial-quant binomial-pmf binomial-rand
432 ;;; Here is where we have a problem -- lispstat core should be core
433 ;;; data management and config problems, with packages providing
434 ;;; specialized extensions to LispStat, i.e. regression, nonlin
435 ;;; regression, bayesian regression via laplace approximation, etc.
437 ;;; The following could be considered "recommended packages", similar
438 ;;; to the idea of the recommended packages in R.
441 regression-model regression-model-proto x y intercept sweep-matrix
442 basis weights included total-sum-of-squares residual-sum-of-squares
443 predictor-names response-name case-labels
446 nreg-model nreg-model-proto mean-function theta-hat epsilon
450 bayes-model bayes-model-proto bayes-internals
))
453 (defpackage :lisp-stat-data-examples
454 (:documentation
"Example data for unittests, examples, illustrations,")
457 (:shadowing-import-from
:lisp-stat
458 slot-value call-method call-next-method
460 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
461 asin acos atan sinh cosh tanh asinh acosh atanh float random
462 truncate floor ceiling round minusp zerop plusp evenp oddp
463 < <= = /= >= > > ;; complex
464 conjugate realpart imagpart phase
465 min max logand logior logxor lognot ffloor fceiling
466 ftruncate fround signum cis
469 (:export iron aluminum absorbtion
473 (defpackage :lisp-stat-user
474 (:documentation
"Experimentation package for LispStat.
475 Serious work should be placed in a similar package elsewhere for
476 reproducibility. But this should hint as to what needs to be
477 done for a user- or analysis-package.")
478 (:nicknames
:ls-user
)
481 :lisp-stat-data-examples
) ;; this last is to have 'things to play with'
482 (:shadowing-import-from
:lisp-stat
483 slot-value call-method call-next-method
485 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
486 asin acos atan sinh cosh tanh asinh acosh atanh float random
487 truncate floor ceiling round minusp zerop plusp evenp oddp
488 < <= = /= >= > > ;; complex
489 conjugate realpart imagpart phase
490 min max logand logior logxor lognot ffloor fceiling
491 ftruncate fround signum cis
497 (defpackage :lisp-stat-unittests
498 (:use
:common-lisp
:lift
:lisp-stat
)
499 (:shadowing-import-from
:lisp-stat
500 slot-value call-method call-next-method
;; objects
501 expt
+ -
* / ** mod rem abs
1+ 1- log exp sqrt sin cos tan
;; lsmath
502 asin acos atan sinh cosh tanh asinh acosh atanh float random
503 truncate floor ceiling round minusp zerop plusp evenp oddp
504 < <= = /= >= > ;; complex
505 conjugate realpart imagpart phase
506 min max logand logior logxor lognot ffloor fceiling
507 ftruncate fround signum cis
)
508 (:export run-lisp-stat-tests run-lisp-stat-test scoreboard
; exec
509 almost
= almost
=lists numerical
=)) ; compare
512 (defpackage :lisp-stat-data-clos-example
514 :lift
:lisp-stat-unittests
515 :lisp-stat-data-clos
))