File: leukemia.lsp

package info (click to toggle)
xlispstat 3.52.14-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 7,560 kB
  • ctags: 12,676
  • sloc: ansic: 91,357; lisp: 21,759; sh: 1,525; makefile: 521; csh: 1
file content (25 lines) | stat: -rw-r--r-- 703 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(require "bayes")

(def wbc-pos (list 2300 750 4300 2600 6000 10500 10000 17000 5400 7000
                   9400 32000 35000 100000 100000 52000 100000))

(def transformed-wbc-pos (- (log wbc-pos) (log 10000)))

(def times-pos (list 65 156 100 134 16 108 121 4 39 143 56 26 22 1 1 5 65))

(defun llik-pos (theta)
  (let* ((x transformed-wbc-pos)
	 (y times-pos)
	 (theta0 (select theta 0))
	 (theta1 (select theta 1))
	 (t1x (* theta1 x)))
    (- (sum t1x)
       (* (length x) (log theta0))
       (/ (sum (* y (exp t1x)))
	  theta0))))

(defun lk-sprob (theta)
  (let* ((time 52.0)
         (x (log 5))
         (mu (* (select theta 0) (exp (- (* (select theta 1) x))))))
    (exp (- (/ time mu)))))