3 Time-stamp: <2010-09-06 16:57:21 tony>
4 Creation: <2008-09-08 08:06:30 tony>
9 Author: AJ Rossini <blindglobe@gmail.com>
10 Copyright: (c) 2007-2008, AJ Rossini <blindglobe@gmail.com>. BSD.
11 Purpose: Stuff that needs to be made working sits inside the
12 progns... This file contains the current challenges to
13 solve, including a description of the setup and the work
16 What is this talk of 'release'? Klingons do not make software
17 'releases'. Our software 'escapes', leaving a bloody trail of
18 designers and quality assurance people in its wake.
30 ;;(asdf:oos 'asdf:load-op 'lisp-matrix)
31 ;;(asdf:oos 'asdf:compile-op 'cls :force t)
32 (asdf:oos 'asdf:load-op :cls)
35 ;; (asdf:oos 'asdf:load-op 'cl-cairo2-x11)
36 ;; (asdf:oos 'asdf:compile-op 'iterate :force t)
37 (asdf:oos 'asdf:load-op 'iterate)
38 ;; (asdf:oos 'asdf:compile-op :cl-2d :force t)
39 (asdf:oos 'asdf:load-op 'cl-2d)
42 (asdf:oos 'asdf:load-op 'cl-pdf)
43 (asdf:oos 'asdf:load-op 'cl-typesetting))
46 ;; (asdf:oos 'asdf:compile-op 'asdf-system-connections :force t)
47 ;; (asdf:oos 'asdf:compile-op 'lisp-matrix)
48 ;; (asdf:oos 'asdf:load-op 'xarray)
51 ;;; (asdf:oos 'asdf:compile-op 'metatilities-base :force t)
52 ;;; (asdf:oos 'asdf:load-op 'metatilities-base)
53 ;;; (asdf:oos 'asdf:load-op 'anaphora)
54 ;;; (asdf:oos 'asdf:load-op 'tinaa)
55 ;;; (asdf:oos 'asdf:load-op 'cl-ppcre)
56 ;; (asdf:oos 'asdf:load-op 'cl-markdown) ;; just need this and the next...
57 ;; (asdf:oos 'asdf:load-op 'docudown)
59 ;;use of extension packages supporting versioning and validation of
61 ;; (asdf:oos 'asdf:compile-op 'versioned-objects :force t)
62 ;; (asdf:oos 'asdf:load-op 'versioned-objects)
63 ;; (asdf:oos 'asdf:compile-op 'validations :force t)
64 ;; (asdf:oos 'asdf:load-op 'validations)
67 ;; (asdf:oos 'asdf:compile-op 'cffi :force t)
68 ;; (asdf:oos 'asdf:load-op 'cl-opengl)
69 ;; (asdf:oos 'asdf:load-op 'cl-glu)
70 ;; (asdf:oos 'asdf:load-op 'cl-glut)
71 ;; (asdf:oos 'asdf:load-op 'cl-glut-examples)
73 ;; (asdf:oos 'asdf:load-op 'cells)
74 (asdf:oos 'asdf:load-op 'bordeaux-threads)
75 ;; (asdf:oos 'asdf:load-op 'cells-gtk)
81 (in-package :lisp-stat-unittests)
83 ;; tests = 78, failures = 7, errors = 20
84 (run-tests :suite 'lisp-stat-ut)
86 (asdf:oos 'asdf:test-op 'cls)
87 ;; which runs (describe (run-tests :suite 'lisp-stat-ut))
89 (describe 'lisp-stat-ut)
90 (documentation 'lisp-stat-ut 'type)
92 ;; FIXME: Example: currently not relevant, yet
93 ;; (describe (lift::run-test :test-case 'lisp-stat-unittests::create-proto
94 ;; :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
96 (describe (lift::run-tests :suite 'lisp-stat-ut-dataframe))
97 (lift::run-tests :suite 'lisp-stat-ut-dataframe)
99 (describe (lift::run-test
100 :test-case 'lisp-stat-unittests::create-proto
101 :suite 'lisp-stat-unittests::lisp-stat-ut-proto))
103 (in-package :ls-user)
105 ;;; Tasks working on...
112 ;; Syntax examples using lexical scope, closures, and bindings to
113 ;; ensure a clean communication of results
114 (with-data dataset ((dsvarname1 [usevarname1])
115 (dsvarname2 [usevarname2]))
118 (defparameter *df-test*
119 (make-instance 'dataframe-array
120 :storage #2A (('a "test0" 0 0d0)
126 :case-labels (list "0" "1" 2 "3" "4")
127 :var-labels (list "symbol" "string" "integer" "double-float")
128 :var-types (list 'symbol 'string 'integer 'double-float)))
130 *df-test* ; but with SBCL, ints become floats?
132 (defun check-var (df colnum)
133 (let ((nobs (xdim (dataset df) 0)))
135 (check-type (xref df i colnum) (elt (var-types df) i)))))
137 (xdim (dataset *df-test*) 1)
138 (xdim (dataset *df-test*) 0)
140 (check-var *df-test* 0)
143 (xref *df-test* 1 1))
145 (check-type (xref *df-test* 1 1)
146 string) ;; => nil, so good.
147 (check-type (xref *df-test* 1 1)
148 vector) ;; => nil, so good.
149 (check-type (xref *df-test* 1 1)
150 real) ;; => simple-error type thrown, so good.
152 ;; How to nest errors within errors?
153 (check-type (check-type (xref *df-test* 1 1) real) ;; => error thrown, so good.
161 (integerp (xref *df-test* 1 2))
162 (floatp (xref *df-test* 1 2))
163 (integerp (xref *df-test* 1 3))
164 (type-of (xref *df-test* 1 3))
165 (floatp (xref *df-test* 1 3))
167 (type-of (vector 1 1d0))
174 (xref *df-test* 1 '*)
176 ;;; Experiments with cl-variates
178 ;; (asdf:oos 'asdf:compile-op 'cl-variates :force t)
179 ;; (asdf:oos 'asdf:compile-op 'cl-variates-test :force t)
180 ;; (asdf:oos 'asdf:load-op 'lift)
181 ;; (asdf:oos 'asdf:compile-op 'lift :force t)
182 ;; (asdf:oos 'asdf:load-op 'cl-variates)
183 (asdf:oos 'asdf:load-op 'cl-variates-test)
185 (in-package :cl-variates-test)
187 (run-tests :suite 'cl-variates-test)
188 (describe (run-tests :suite 'cl-variates-test))
190 (in-package :cl-variates-user)
192 (defparameter state (make-random-number-generator))
193 (setf (random-seed state) 44)
195 (loop for i from 1 to 10 collect
196 (random-range state 0 10))
197 ;; => (1 5 1 0 7 1 2 2 8 10)
198 (setf (random-seed state) 44)
199 (loop for i from 1 to 10 collect
200 (random-range state 0 10))
201 ;; => (1 5 1 0 7 1 2 2 8 10)
203 (setf (random-seed state) 44)
205 (loop for i from 1 to 10 collect
206 (normal-random state 0 1))
208 ;; (-1.2968656102820426 0.40746363934173213 -0.8594712469518473 0.8795681301148328
209 ;; 1.0731526250004264 -0.8161629082481728 0.7001813608754809 0.1078045427044097
210 ;; 0.20750134211656893 -0.14501914108452274)
212 (setf (random-seed state) 44)
213 (loop for i from 1 to 10 collect
214 (normal-random state 0 1))
216 ;; (-1.2968656102820426 0.40746363934173213 -0.8594712469518473 0.8795681301148328
217 ;; 1.0731526250004264 -0.8161629082481728 0.7001813608754809 0.1078045427044097
218 ;; 0.20750134211656893 -0.14501914108452274)
221 ;;; experiments with LLA
222 (in-package :cl-user)
223 (asdf:oos 'asdf:load-op 'lla)
224 (in-package :lla-user)
228 (in-package :cls-user)
233 ;; population design eval and opt
241 number of samples/cost of lab analysis and collection
245 (defun pfim (&key model ( constraints ( summary-function )
247 (list num-subjects num-times list-times))))
251 Each individal has a deisgn psi_i
252 nubmer of samples n_i and sampling times t_{i{1}} t_{i{n_1}}
253 individuals can differ
257 individual-level model
260 (=model y_i (+ (f \theta_i \psi_i) epsilion_i ))
261 (=var \epsilion_i \sigma_between \sigma_within )
263 ;; Information Matrix for pop deisgn
265 (defparameter IM (sum (i 1 N) (MF \psi_i \phi_i)))
268 For nonlinear structureal models, expand around RE=0
270 Cramer-Rao : MF^{-1} is lower bound for estimation variance.
274 - smallest SE, but is a matrix, so
275 - criteria for matrix comparison
276 -- D-opt, (power (determinant MF) (/ 1 P))
279 find design maxing D opt, (power (determinant MF) (/ 1 P))
281 -- contin vars for smapling times within interval or set
282 -- number of groups for cat vars
284 Stat in Med 2009, expansion around post-hoc RE est, not necessarily zero.
286 Example binary covariate C
289 (if (= i reference-class)
294 (=model (log \theta) ( ))
301 PFIM provides for a given design and values of \beta:
303 SE/RSE for \beta of each class of each covar
304 eval influence of design on SE(\beta)
306 inter-occassion variability (IOV)
307 - patients sampled more than once, H occassions
309 - additional vars to estimate
313 ;;; comparison criteria
315 functional of conc/time curve which is used for comparison, i.e.
316 (AUC conc/time-curve)
317 (Cmax conc/time-curve)
318 (Tmax conc/time-curve)
322 (defun conc/time-curve (t)
325 (let ((conc (exp (* t \beta1))))
331 (url-get "www.pfim.biostat.fr")
333 ;;; Thinking of generics...
334 (information-matrix model parameters)
335 (information-matrix variance-matrix)
336 (information-matrix model data)
337 (information-matrix list-of-individual-IMs)
340 (defun IM (loglikelihood parameters times)
341 "Does double work. Sum up the resulting IMs to form a full IM."
342 (let ((IM (make-matrix (length parameters)
344 :initial-value 0.0d0)))
345 (dolist (parameterI parameters)
346 (dolist (parameterJ parameters)
348 (differentiate (differentiate loglikelihood parameterI) parameterJ))))))
352 ;; difference between empirical, fisherian, and ...? information.
357 (asdf:oos 'asdf:compile-op :ironclad)
359 (in-package :cl-user)
360 (asdf:oos 'asdf:load-op :cl-genomic)
362 (in-package :bio-sequence)
363 (make-dna "agccg") ;; fine
364 (make-aa "agccg") ;; fine
365 (make-aa "agc9zz") ;; error