document some tasks in dataframe.lisp that need resolution.
[CommonLispStat.git] / TODO.org
blob7a80921eed800322440876cafbd7513e59df9de9
1 #+STARTUP: logdone
2 #+STARTUP: lognotedone
4 #+TODO: TODO CURR | DONE
5 #+TODO: POSTPONED | CANCELED
8 Time-stamp: <2012-10-12 16:34:40 tony>
9 Creation:   <2008-09-08 08:06:30 tony>
11 * Intro and Metadata
13 File:       TODO.lisp
14 Author:     AJ Rossini <blindglobe@gmail.com>
15 Copyright:  (c) 2007-2012, AJ Rossini <blindglobe@gmail.com>.  MIT license.
16 Purpose:    Stuff that needs to be made working sits inside the
17             Task sections.
19             This file contains the current challenges to solve,
20             including a description of the setup and the work to
21             solve.  Solutions welcome.
23 What is this talk of 'release'? Klingons do not make software
24 'releases'.  Our software 'escapes', leaving a bloody trail of
25 designers and quality assurance people in its wake.
27 * Approach and Design, Strategy and Tactics
29 ** Approach
31    Please develop possible high level API code in examples
32    subdirectory -- when we get it "reasonable", migrate into
33    appropriate core code directories in the src subdirectory. 
35 ** Design
37    Collection of packages.  Include as appropriate, so that we end up
38    with a coherent collection as needed.
40 ** (Internal) Package and (External) System Hierarchy
42   This section provides some of the details regarding infrastructure of
43   the system.
45   current (possibly incomplete) set of lisp dependencies <2012-10-04 Thu>
47  0  ~/sandbox/xarray.git
48  1  ~/sandbox/foreign-numeric-vector.git
49  2  ~/sandbox/trivial-features.git
50  3  ~/sandbox/alexandria.git
51  4  ~/sandbox/babel.git
52  5  ~/sandbox/cffi.git
53  6  ~/sandbox/cl-utilities
54  7  ~/sandbox/metabang-bind.git
55  8  ~/sandbox/iterate.git
56  9  ~/sandbox/array-operations.git
59 *** Singletons (primary building blocks)
60     
61     These are packages as well as 
63     | asdf          | common system loader                          |
64     | xarray        | common access structure to array-like         |
65     |               | (matrix, vector) structures.                  |
66     | cls-config    | initialization of Lisp state, variables, etc, |
67     |               | localization to the particular lisp.          |
68     | lift          | unit-testing                                  |
69     | cffi          | foriegn function library                      |
70     | alexandria    |                                               |
71     | babel         |                                               |
72     | iterate       |                                               |
73     | metabang-bind |                                               |
75     as of now, all are in QL heirarchy
77 *** Dependency structure
79     | lisp-matrix     | general purpose matrix package, linking to lapack |      |
80     |                 | for numerics. Depends on:                         |      |
81     |                 | ffa                                               | cffi |
82     |                 | fnv                                               | cffi |
83     |                 | cl-blapack                                        | cffi |
84     |                 | xarray                                            |      |
85     | cls-dataframe   | in the same spirit as lisp-matrix, a means to     |      |
86     |                 | create tables.  Perhaps better called datatables? |      |
87     | cls-probability | depends on gsll, cl-variates, cl-? initially,     |      |
89 *** Need to integrate
91 **** Random number streams and probability calculus
94      Something for random numbers, that has a settable seed.  However,
95      we could pass on the "right thing" in favor of something that
96      will "work for now".  
97      cl-randist
99 **** import of data in text files
101      CSV and similar specialized imports
103      rsm-string
105 **** Graphics
107      ?? cl-2d  : 
108                cl-cairo2 : cffi
110      ?? cl-plplot : cffi
113 * Tasks to Do [2/43]
115   Usually, we need to load it everything before going on.
117 #+name: loadit
118 #+begin_src lisp
119   (ql:quickload :cls)
120 #+end_src
122 #+RESULTS: loadit
123 | :CLS |
125   and sometimes we might want to recompile fully:
127 #+name: recompile-it-all
128 #+begin_src lisp
129   (asdf:oos 'asdf:compile-op :cls :force T)
130 #+end_src
132   Currently <2012-10-10 Wed> QuickLisp support doesn't provide a
133   recompilation facility.  And QL is built over and partially extends
134   ASDF, so we should be fine for now.
136 ** DONE [#B] Example of Custom Data analysis set up
137    - State "DONE"       from "CURR"       [2010-10-12 Tue 13:48] \\
138      setup is mostly complete
139    - State "CURR"       from "TODO"       [2010-10-12 Tue 13:47]
140    - State "TODO"       from ""           [2010-10-12 Tue 13:47]
142    This is an example of a custom setup, not really interesting at
143    this point (it will hopefully be obsolete by the first release)
144    except to remind Tony how to program.  Pointy-headed managers need
145    any support they can find in order to regress to their
146    hacker-childhood.
148    The only point of this section is to illustrate that we could want
149    to load additional modules that are not a central part of the core
150    files.
151    
152 #+name: CustomLoader
153 #+begin_src lisp :tangle "examples/CustomLoader.lisp"
154   ;; always ensure we are in the right package to leave droppings and access functionality
155   (in-package :cl-user) 
156   (progn 
157     (defun init-CLS (&key (compile 'nil))
158       (let ((packagesToLoad (list ;; core system
159                                   :lift :lisp-matrix :cls
160                                   ;; visualization
161                                   ;; :cl-cairo2-x11 :iterate
162                                   :cl-2d
163                                   ;; doc reporting
164                                   :cl-pdf :cl-typesetting
165                                   ;;INFRA
166                                   :asdf-system-connections :xarray
167                                   ;;DOCS
168                                   :metatilities-base :anaphora :tinaa
169                                   :cl-ppcre :cl-markdown :docudown
170                                   ;; version and validate CLOS objects
171                                   ;; :versioned-objects :validations
172                                   ;;VIZ
173                                   ;; :cl-opengl
174                                   ;; :cl-glu :cl-glut :cl-glut-examples
175   
176   
177                                   ;; :cells :cells-gtk
178                                   :bordeaux-threads)))
179         (mapcar #'(lambda (x)
180                     (if compile
181                         (asdf:oos 'asdf:compile-op x :force T)
182                         (asdf:oos 'asdf:load-op x)))
183                 packagesToLoad)))
184     ;; (init-CLS :compile T) vs:
185     (init-CLS))
186 #+end_src
188 #+results:
189 |   | #<PACKAGE "COMMON-LISP-USER"> |
191 ** CURR [#A] Integrate with quicklist support.
192    
193    important to merge with quicklisp system loader support.  We
194    currently have some of this work integrated, but I think there are
195    a few systems which are not auto-installable.
197 *** TODO [#B] Determine which packages still need to be in QuickLisp
199     Currently, probably need my versions of files, or will need to
200     preface them as needed.  As we can afford at most 2 more renames,
201     probably have something like cls-cl-XXXX for packages which have
202     API conflicts, and then if we rename the system, something like
203     NAME-RANDOM, NAME-CORE, NAME-MATRIX, etc... as needed.
205 ** CURR [#A] Testing: unit, regression, examples. [0/3]
206    - State "CURR"       from "TODO"       [2010-10-12 Tue 13:51]
207    - State "TODO"       from ""           [2010-10-12 Tue 13:51]
209    Testing consists of unit tests, which internally verify subsets of
210    code, regression tests, and functional tests (in increasing order
211    of scale).
213 *** CURR [#B] Unit tests
214     - State "CURR"       from "TODO"       [2010-11-04 Thu 18:33]
215     - State "CURR"       from "TODO"       [2010-10-12 Tue 13:48]
216     - State "TODO"       from ""           [2010-10-12 Tue 13:48]
218     Unit tests have been started using LIFT.  Need to consider some of
219     the other systems that provide testing, when people add them to
220     the mix of libraries that we need, along with examples of how to
221     use.
223 #+name: ex-cls-unittest
224 #+begin_src lisp
225   (in-package :lisp-stat-unittests)
226   (run-tests :suite 'lisp-stat-ut)
227 #+end_src
229 #+RESULTS: ex-cls-unittest
230 : #<Results for LISP-STAT-UT 66 Tests, 3 Failures, 21 Errors>
233     Before we removed the internal legacy lispstat probability code,
234     we had:
236 : ;; => tests = 78, failures = 7, errors = 20
238     The following needs to be solved in order to have a decent
239     installation qualification (IQ) and performance qualification
240     (PQ).  It currently fails on approach.
242 #+name: cls-unittest
243 #+begin_src lisp
244   (in-package :lisp-stat-unittests)
245   (asdf:oos 'asdf:test-op 'cls) ; (describe (run-tests :suite 'lisp-stat-ut))
246 #+end_src
248     and check documentation to see if it is useful.
250 #+name: unittest-ex
251 #+begin_src lisp
252   (in-package :lisp-stat-unittests)
253   (describe 'lisp-stat-ut)
254   (documentation 'lisp-stat-ut 'type)
255   
256   ;; FIXME: Example: currently not relevant, yet
257   ;;   (describe (lift::run-test :test-case  'lisp-stat-unittests::create-proto
258   ;;                             :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
259   
260   (describe (lift::run-tests :suite 'lisp-stat-ut-dataframe))
261   ;; => Test Report for LISP-STAT-UT-DATAFRAME: 11 tests run, 5 Errors.
262   
263   (lift::run-tests :suite 'lisp-stat-ut-dataframe)
264   
265   ;;; The following barfs, doesn't like test-case keyword
266   ;; (describe (lift::run-test
267   ;;             :test-case  'lisp-stat-unittests::create-proto
268   ;;             :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
269 #+end_src
271 *** TODO [#B] Regression Tests
272     - State "TODO"       from ""           [2010-10-12 Tue 13:54]
274     By regression tests, we refer to tests which focus on probing a
275     range of high level interactions.  The test skeleton should focus
276     on managing complex interactions which are reasonable.  
278 *** TODO [#B] Functional Tests
279     - State "TODO"       from ""           [2010-10-12 Tue 13:54]
281 ** CURR [#B] Functional Examples that need to work [1/3]
282    - State "CURR"       from "TODO"       [2010-11-30 Tue 17:57]
283    - State "TODO"       from ""           [2010-10-12 Tue 13:55]
285    These examples should be functional forms within CLS, describing
286    working functionality which is needed for work.
287 *** TODO [#A] Dataframe creation
288     Illustration via a file, that we need to get working so that we
289     can get data in-and-out of CLS structures.
291 #+BEGIN_SRC lisp :export examples/example-DF-creation.lisp
292   ;;; -*- mode: lisp -*-
293   ;;; Copyright (c) 2006-2012, by A.J. Rossini <blindglobe@gmail.com>
294   ;;; See COPYRIGHT file for any additional restrictions (BSD license).
295   ;;; Since 1991, ANSI was finally finished.  Edited for ANSI Common Lisp. 
296   
297   ;;; Time-stamp: <2012-10-04 02:16:45 tony>
298   ;;; Creation:   <2012-07-01 11:29:42 tony>
299   ;;; File:       example.lisp
300   ;;; Author:     AJ Rossini <blindglobe@gmail.com>
301   ;;; Copyright:  (c) 2012, AJ Rossini.  BSD.
302   ;;; Purpose:    example of possible usage.
303   
304   ;;; What is this talk of 'release'? Klingons do not make software
305   ;;; 'releases'.  Our software 'escapes', leaving a bloody trail of
306   ;;; designers and quality assurance people in its wake.
307   
308   
309   ;; Load system
310   (ql:quickload "cls")
311   
312   ;; use the example package...
313   (in-package :cls-user)
314   
315   
316   ;; or better yet, create a package/namespace for the particular problem being attacked.
317   (defpackage :my-package-user
318     (:documentation "demo of how to put serious work should be placed in
319       a similar package elsewhere for reproducibility.  This hints as to
320       what needs to be done for a user- or analysis-package.")
321     (:nicknames :my-clswork-user)
322     (:use :common-lisp ; always needed for user playgrounds!
323           :lisp-matrix ; we only need the packages that we need...
324           :common-lisp-statistics
325           :lisp-stat-data-examples) ;; this ensures access to a data package
326     (:export summarize-data summarize-results this-data this-report)
327     (:shadowing-import-from :lisp-stat call-method call-next-method
328   
329         expt + - * / ** mod rem abs 1+ 1- log exp sqrt sin cos tan
330         asin acos atan sinh cosh tanh asinh acosh atanh float random
331         truncate floor ceiling round minusp zerop plusp evenp oddp 
332         < <= = /= >= > > ;; complex
333         conjugate realpart imagpart phase
334         min max logand logior logxor lognot ffloor fceiling
335         ftruncate fround signum cis
336   
337         <= float imagpart)) 
338   
339   (in-package :my-clswork-user)
340   
341   ;; create some data by hand using arrays, and demonstrate access. 
342   
343   (let ((myArray #2A((1 2 3)(4 5 6)))
344         (myDF    (make-dataframe #2A((1 2 3)(4 5 6))))
345         (myLOL   (list (list 1 2 3) (list 4 5 6)))
346         ;; FIXME: listoflist conversion does not work.
347         ;; (myDFlol (make-dataframe  '(list ((1 2 3)(4 5 6)))))
348         )
349   
350     (= (xref myArray 1 1)
351        (xref myDF    1 1)
352        (xref myLOL   1 1)))
353   
354 #+END_SRC
355 *** TODO [#B] Scoping with datasets
356     - State "TODO"       from ""           [2010-11-04 Thu 18:46]
358     The following needs to work, and a related syntax for resampling
359     and similar synthetic data approaches (bootstrapping, imputation)
360     ought to use similar syntax as well.
361 #+name: DataSetNameScoping
362 #+begin_src lisp
363   (in-package :ls-user)
364   (progn
365     ;; Syntax examples using lexical scope, closures, and bindings to
366     ;; ensure a clean communication of results
367     ;; This is actually a bit tricky, since we need to clarify whether
368     ;; it is line-at-a-time that we are considering or if there is
369     ;; another mapping strategy.  In particular, one could imagine a
370     ;; looping-over-observations function, or a
371     ;; looping-over-independent-observations function which leverages a
372     ;; grouping variable which provides guidance for what is considered
373     ;; independent from the sampling frame being considered. The frame
374     ;; itself (definable via some form of metadata to clarify scope?)
375     ;; could clearly provide a bit of relativity for clarifying what
376     ;; statistical independence means.
377     
378     (with-data dataset ((dsvarname1 [usevarname1])
379                         (dsvarname2 [usevarname2]))
380         @body)
381   
382     ;; SAS-centric approach to spec'ing work 
383     (looping-over-observations
384        dataset ((dsvarname1 [usevarname1])
385                 (dsvarname2 [usevarname2]))
386          @body)
387   
388     ;; SAS plus "statistical sensibility"... for example, if an
389     ;; independent observation actually consists of many observations so
390     ;; that a dataframe of independence results -- for example,
391     ;; longitudinal data or spatial data or local-truncated network data
392     ;; are clean examples of such happening -- then we get the data
393     ;; frame or row representing the independent result.
394     (looping-over-independent-observations
395        dataset independence-defining-variable
396          ((dsvarname1 [usevarname1])
397           (dsvarname2 [usevarname2]))
398          @body)
399     )
400 #+end_src
402 *** DONE [#B] Dataframe variable typing
403     - State "DONE"       from "CURR"       [2010-11-30 Tue 17:56] \\
404       check-type approach works, we would just have to throw a catchable
405       error if we want to use it in a reliable fashion.
406     - State "CURR"       from "TODO"       [2010-11-30 Tue 17:56]
407     - State "TODO"       from ""           [2010-11-04 Thu 18:48]
409     Seems to generally work, need to ensure that we use this for
410     appropriate typing.
412 #+name: DFvarTyping
413 #+begin_src lisp
414   (in-package :ls-user)
415   (defparameter *df-test*
416     (make-instance 'dataframe-array
417                    :storage #2A (('a "test0" 0 0d0)
418                                  ('b "test1" 1 1d0)
419                                  ('c "test2" 2 2d0)
420                                  ('d "test3" 3 3d0)
421                                  ('e "test4" 4 4d0))
422                    :doc "test reality"
423                    :case-labels (list "0" "1" 2 "3" "4")
424                    :var-labels (list "symbol" "string" "integer" "double-float")
425                    :var-types (list 'symbol 'string 'integer 'double-float)))
426   
427   ;; with SBCL, ints become floats?  Need to adjust output
428   ;; representation appropriately..
429   ,*df-test* 
430   
431   (defun check-var (df colnum)
432     (let ((nobs (xdim (dataset df) 0)))
433       (dotimes (i nobs)
434         (check-type (xref df i colnum) (elt (var-types df) i)))))
435   
436   (xdim (dataset *df-test*) 1)
437   (xdim (dataset *df-test*) 0)
438   
439   (check-var *df-test* 0)
440   
441   (class-of
442     (xref *df-test* 1 1))
443   
444   (check-type (xref *df-test* 1 1)
445               string) ;; => nil, so good.
446   (check-type (xref *df-test* 1 1)
447               vector) ;; => nil, so good.
448   (check-type (xref *df-test* 1 1)
449               real) ;; => simple-error type thrown, so good.
450   
451   ;; How to nest errors within errors?
452   (check-type (check-type (xref *df-test* 1 1) real) ;; => error thrown, so good.
453               simple-error)
454   (xref *df-test* 1 2)
455   
456   (check-type *df-test*
457               dataframe-array) ; nil is good.
458   
459   (integerp (xref *df-test* 1 2))
460   (floatp (xref *df-test* 1 2))
461   (integerp (xref *df-test* 1 3))
462   (type-of (xref *df-test* 1 3))
463   (floatp (xref *df-test* 1 3))
464   
465   (type-of (vector 1 1d0))
466   (type-of *df-test*)
467   
468   (xref *df-test* 2 1)
469   (xref *df-test* 0 0)
470   (xref *df-test* 1 0)
471   (xref *df-test* 1 '*)
472 #+end_src
473   
474 ** CURR [#A] Random Numbers [2/6]
475    - State "CURR"       from "TODO"       [2010-11-05 Fri 15:41]
476    - State "TODO"       from ""           [2010-10-14 Thu 00:12]
478    Need to select and choose a probability system (probability
479    functions, random numbers).  Goal is to have a general framework
480    for representing probability functions, functionals on
481    probabilities, and reproducible random streams based on such
482    numbers. 
483 *** CURR [#B] CL-VARIATES system evaluation [2/3]
484     - State "CURR"       from "TODO"       [2010-11-05 Fri 15:40]
485     - State "TODO"       from ""           [2010-10-12 Tue 14:16]
486     
487     CL-VARIATES is a system developed by Gary W King.  It uses streams
488     with seeds, and is hence reproducible.  (Random comment: why do CL
489     programmers as a class ignore computational reproducibility?)
491     The main problem with this system is licensing.  It has a weird
492     licensing schema which prevents 
494 #+name: Loading-CL-VARIATES
495 #+begin_src lisp
496   (in-package :cl-user)
497   (ql:quickload :cl-variates)
498   ;;(ql:quickload :cl-variates-test)
499 #+end_src
501 #+name: CL-VARIATES-UNITTESTS
502 #+begin_src lisp
503   (in-package :cl-variates-test)
504   ;; check tests
505   (run-tests :suite 'cl-variates-test)
506   (describe (run-tests :suite 'cl-variates-test))
507 #+end_src
509     basic example of reproducible draws from the uniform and normal
510     random number streams.
512 #+name: CL-VARIATES-REPRO
513 #+begin_src lisp
514   
515   (in-package :cl-variates-user)
516   
517   (defparameter state (make-random-number-generator))
518   (setf (random-seed state) 44)
519   
520   (random-seed state)
521   (loop for i from 1 to 10 collect
522                     (random-range state 0 10))
523   ;; => (1 5 1 0 7 1 2 2 8 10)
524   (setf (random-seed state) 44)
525   (loop for i from 1 to 10 collect
526                     (random-range state 0 10))
527   ;; => (1 5 1 0 7 1 2 2 8 10)
528   
529   (setf (random-seed state) 44)
530   (random-seed state)
531   (loop for i from 1 to 10 collect
532                     (normal-random state 0 1))
533   ;; => 
534   ;; (-1.2968656102820426 0.40746363934173213 -0.8594712469518473 0.8795681301148328
535   ;;  1.0731526250004264 -0.8161629082481728 0.7001813608754809 0.1078045427044097
536   ;;  0.20750134211656893 -0.14501914108452274)
537   
538   (setf (random-seed state) 44)
539   (loop for i from 1 to 10 collect
540                     (normal-random state 0 1))
541   ;; => 
542   ;; (-1.2968656102820426 0.40746363934173213 -0.8594712469518473 0.8795681301148328
543   ;;  1.0731526250004264 -0.8161629082481728 0.7001813608754809 0.1078045427044097
544   ;;  0.20750134211656893 -0.14501914108452274)
545   
546 #+end_src
548 **** CURR [#B] Full example of general usage 
549      - State "CURR"       from "TODO"       [2010-11-05 Fri 15:40]
550      - State "TODO"       from ""           [2010-11-05 Fri 15:40]
552      What we want to do here is describe the basic available API that
553      is present.  So while the previous work describes what the basic
554      reproducibility approach would be in terms of generating lists of
555      reproducible pRNG streams, we need the full range of possible
556      probability laws that are present. 
558      One of the good things about cl-variates is that it provides for
559      reproducibility.  One of the bad things is that it has a mixed
560      bag for an API.
562 *** TODO [#B] CL-RANDOM system evaluation
563     - State "TODO"       from ""           [2010-11-05 Fri 15:40]
565     Problems:
566     1. no seed setting for random numbers
567     2. contamination of a probability support with optimization and
568        linear algebra.
570     Positives:
571     1. good code
572     2. nice design for generics.
573        
574 *** TODO [#B] Native CLS (from XLS)
575     - State "TODO"       from ""           [2010-11-05 Fri 15:40]
576       
577 ** TODO [#B] Numerical Linear Algebra [0/6]
578    - State "TODO"       from ""           [2010-10-14 Thu 00:12]
580 *** TODO [#B] LLA evaluation
581     - State "TODO"       from ""           [2010-10-12 Tue 14:13]
583 LLA is an SBCL targetted linear algebra library from Tamas Papp
585 #+NAME LLA-experiments
586 #+BEGIN_SRC lisp
587 (in-package :cl-user)
588 (asdf:oos 'asdf:load-op 'lla)
589 (in-package :lla-user)
590 ;;; experiment here
591 #+END_SRC
593 *** CURR [#B] Lisp-Matrix system evaluation
594     - State "CURR"       from "TODO"       [2010-10-12 Tue 14:13]
595     - State "TODO"       from ""           [2010-10-12 Tue 14:13]
597       in progress
599 *** TODO [#A] Review GSLL and Antik as per Mirko's suggestion [0/2]
601     <2012-10-12 Fri>: Mirko suggested this approach.  Might look into
602     using GSLL and Antik to augment lisp-matrix, pRNG selection (GSLL)
603     and replace xarray (Antik).
605 **** TODO [#A] Review Antik
606      
607      evaluation should go here
609 **** TODO [#A] Review GSLL
611      evaluation (updated to <2012-10-12 Fri>, removing Tony's obsolete
612      opinions) should go here.
614 *** TODO [#B] LispLab system evaluation
615     - State "TODO"       from ""           [2010-10-12 Tue 14:13]
617 LL is an SBCL targetted linear algebra library from ---
619 ** TODO [#B] Numerical Statistical Procedures to implement
621    By this, I mean procedures which provide numerical quantitative or
622    precise categorical qualitative results (for example, excluding
623    visualizations, which tend to produce very useful but relatively
624    imprecise actionable insights).
626 *** CURR [#A] Basic Descriptives
628 *** TODO [#C] PFIM 
630 #+BEGIN_SRC lisp
632 (in-package :cls-user)
633 ;;;; PFIM notes
635 ;; PFIM 3.2 
637 ;; population design eval and opt
638 #| 
639 issues: 
640 - # individuals
641 - # sampling times
642 - sampling times?
644 constraints:
645 number of samples/cost of lab analysis and collection
646 expt constraints
649 (defun pfim (&key model ( constraints ( summary-function )
651   (list num-subjects num-times list-times))))
654 N individuals i
655 Each individal has a deisgn psi_i
656    nubmer of samples n_i and sampling times t_{i{1}} t_{i{n_1}}
657    individuals can differ
659 Model:
661 individual-level model 
664 (=model y_i (+ (f \theta_i \psi_i) epsilion_i ))
665 (=var \epsilion_i \sigma_between \sigma_within  )
667 ;; Information Matrix for pop deisgn 
669 (defparameter IM (sum  (i 1 N) (MF \psi_i \phi_i)))
672 For nonlinear structureal models, expand around RE=0
674 Cramer-Rao : MF^{-1} is lower bound for estimation variance.
676 Design comparisons: 
678 - smallest SE, but is a matrix, so
679 - criteria for matrix comparison
680 -- D-opt, (power (determinant MF) (/ 1 P))
683 find design maxing D opt, (power (determinant MF) (/ 1 P))
684 Design varialables 
685  -- contin vars for smapling times within interval or set -- number of groups for cat vars
687 Stat in Med 2009, expansion around post-hoc RE est, not necessarily zero.
689 Example binary covariate C
692 (if (= i reference-class) 
693     (setf (aref C i) 0)
694     (setf (aref C i) 1))
696 ;; Exponential RE,
697 (=model (log \theta) (  ))
699 ;; extensions
701 ;; outputs
704 PFIM provides for a given design and values of \beta: 
705  compute extended FIM
706  SE/RSE for \beta of each class of each covar
707  eval influence of design on SE(\beta)
709 inter-occassion variability (IOV)
710 - patients sampled more than once, H occassions
711 - RE for IOV
712 - additional vars to estimate
716 ;;; comparison criteria
718 functional of conc/time curve which is used for comparison, i.e. 
719 (AUC conc/time-curve)
720 (Cmax conc/time-curve)
721 (Tmax conc/time-curve)
723 where 
725 (defun conc/time-curve (t) 
726   ;; computation
727 #| 
728   (let ((conc (exp (* t \beta1))))
729      conc)
731   )
733 ;;See
734 (url-get "www.pfim.biostat.fr")
737 ;;; Thinking of generics...
738 (information-matrix model parameters)
739 (information-matrix variance-matrix)
740 (information-matrix model data)
741 (information-matrix list-of-individual-IMs)
744 (defun IM (loglikelihood parameters times)
745   "Does double work.  Sum up the resulting IMs to form a full IM."
746   (let ((IM (make-matrix (length parameters)
747                          (length parameters)
748                          :initial-value 0.0d0)))
749     (dolist (parameterI parameters)
750       (dolist (parameterJ parameters)
751         (setf (aref IM I J)
752               (differentiate (differentiate loglikelihood parameterI) parameterJ))))))
753 #+END_SRC
755 *** TODO [#C] difference between empirical, fisherian, and ...? information.
756 *** TODO [#C] Example of Integration with CL-GENOMIC
757     - State "TODO"       from ""           [2010-10-12 Tue 14:03]
758     
759     CL-GENOMIC is a very interesting data-structure strategy for
760     manipulating sequence data.
762 #+name: CL-GENOMIC
763 #+begin_src lisp
764     (in-package :cl-user)
765     (asdf:oos 'asdf:compile-op :ironclad)
766     (asdf:oos 'asdf:load-op :cl-genomic)
768     (in-package :bio-sequence)
769     (make-dna "agccg") ;; fine
770     (make-aa "agccg")  ;; fine
771     (make-aa "agc9zz") ;; error expected
772 #+end_src
774 ** TODO [#A] Visual data analytic methods [0/10]
775 *** TODO [#B] Evaluate Graphics toolkits [0/3]
777 **** TODO [#B] QT and similar tools
779      Pros: Insight from Deepyan Saarkar and Mike -- super fast plot
780      routines for dynamic interactive graphics.  Crossplatform.
782      Common-QT, or ??
784 **** TODO [#B] Cairo-based
786      Pros: actually have example lattice/trellis plotting system with
787      Tamas Papp's cl-2d based on cl-cairo2.
789      Con: cross-platform?  setup on a mac?
791 **** TODO [#C] Others?
793      increase priority if someone cares enough to code
795 *** TODO [#A] Evaluate APIs, methods, designs, back-end into framework [0/2]
796     By this, I mean that we need a good proposal, and it should be
797     based on history.  I need to email Paul Murrell and Deepyan and
798     Hadley for a "lessons learned in statistical graphics systems".  
799 **** TODO [#B] Paul Murrell's core R system (grid?)
801 **** TODO [#B] Peter Siebel's Grammer of Graphics javascript implementation
802      Thanks Peter Schmiedeskamp for pointing this out.
804 *** TODO [#B] Implement Visualization routines [0/2]
805     This should happen one-two times.  Remember, with the package
806     approach, we can try out new packages and continually build newer
807     ones, as long as we appropriately version the interface for user
808     selection purposes.
809 **** TODO [#A] actual statistical graphics
810      we need functions to x-y plots, bar charts, and need the API to
811      describe in terms of statistical quantities, scatter plots,
812      etc.
814      Also, will be important to get prototypes working ASAP to get
815      testing and feedback.  But remember, not all users want what is
816      good for them, just like not all people "honestly prefer"
817      completely healthy approaches to life.
819       See file:README.org and the Philosophy for background for the
820       above. 
822 **** TODO [#C] Statistical toolkit and pipeline, ala ORCA 
824      Orca (sutherland, cook, lumley, rossini, etal) was a java based
825      toolkit for pipelined DAG representations of interactive dynamic
826      graphics.
828 ** TODO [#B] Documentation and Examples [0/3]
829    - State "TODO"       from ""           [2010-10-14 Thu 00:12]
831    I've started putting examples of use in function documentation.  If
832    you are a lisp'er, you'll find this pendantic and insulting.  Many
833    of the uses are trivial.  However, this has been tested out on a
834    number of research statisticians (the primary user audience) and
835    found useful.
837    Still need to write the 
839 #+BEGIN_SRC lisp
840   (evaluate-documentation-example 'function-name)
841 #+END_SRC
843    function, which would print out the example and run it live.
844    Hopefully with the same results.  Need to setup the infrastructure,
845    but basically, we'd like something like:
847 #+name: Example-InLineDoc
848 #+begin_src lisp
849   (cls-example-progn
850       (example-code-for-function-1)
851       (example-code-for-function-...)
852       (example-code-for-function-n))
853 #+end_src
855    and have this within the doc-string.  Then the doc-string would be
856    parsed for the appropriate code and we'd get the results, evaluated
857    in a special name space derived from the object (function, class)
858    name, possibly with the corresponding functions and environment
859    set up that would be required.  OR, it could just work in cl-user
860    (which is the default starting location.
862    Here are some possible common lisp systems that could be
863    evaluated:
865 *** TODO [#B] Docudown
866     - State "TODO"       from ""           [2010-11-05 Fri 15:34]
868 *** TODO [#A] CLDOC
869     - State "TODO"       from ""           [2010-11-05 Fri 15:34]
871 *** TODO [#B] CLPDF, and literate data analysis
872     - State "TODO"       from ""           [2010-11-05 Fri 15:34]
874 * Proposals
875   Place proposals for features, work, etc here...
876 ** <2011-12-29 Thu> new stuff
877    First new proposal is to track proposals.
879 * Rejoinder
881   This project is dedicated to all the lisp hackers out there who
882   provided the basic infrastructure to get so far so fast with minimal
883   effort on my part.
885   And to all the people trying to help to get this off the ground.