start of lisp-matrix conversion. Generic functions for statistical processing.
[CommonLispStat.git] / Data / aircraft.lsp
blob3d2db374618c99d1d4ada494ea3d320a714dc8d2
1 ;;; -*- mode: lisp -*-
3 ;;; From LispStat 1 : need to document source appropriately.
5 (in-package :lisp-stat-data-examples)
7 ;;; FIXME: Shutup compiler warnings, need to clean up and
8 ;;; appropriately initialize.
9 (defvar failure-times nil)
13 ;;(require "maximize")
15 (def failure-times
16 '((413 14 58 37 100 65 9 169 447 184 36 201 118 34 31
17 18 18 67 57 62 7 22 34)
18 (90 10 60 186 61 49 14 24 56 20 79 84 44 59 29 118 25 156
19 310 76 26 44 23 62 130 208 70 101 208)
20 (74 57 48 29 502 12 70 21 29 386 59 27 153 26 326)
21 (55 320 65 104 220 239 47 246 176 182 33 15 104 35)
22 (23 261 87 7 120 14 62 47 225 71 246 21 42 20 5 12 120
23 11 3 14 71 11 14 11 16 90 1 16 52 95)))
25 (def x (select failure-times 1))
27 (defun gllik (theta)
28 (let* ((mu (select theta 0))
29 (beta (select theta 1))
30 (n (length x))
31 (bym (* x (/ beta mu))))
32 (+ (* n (- (log beta) (log mu) (log-gamma beta)))
33 (sum (* (- beta 1) (log bym)))
34 (sum (- bym)))))