;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; This file is part of "NOVA": NOVA = search + COCOMO tools ; Copyright, 2008, Tim Menzies tim@menzies.us ; ; NOVA is free software: you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation, either version 3 of the License, or ; (at your option) any later version. ; ; NOVA is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; You should have received a copy of the GNU General Public License ; a long with NOVA. If not, see . ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (in-package :wvu-lib-test.tricks) ;;; stats stuff (deftestsuite stats-lib-test-suite (wvu-lib-tests) ()) ;;TODO stdev tests ;;TODO stdev-from-list tests (addtest stats (ensure-same (sum '(1 1 1 1 2 2 4 100)) 112 :report "computing the sum of a list of numbers") (ensure-same (mean '(1 1 1 1 2 2 4 100)) 14 :report "computing the mean of a list of numbers") (ensure-same (median '(1 1 1 1 2 2 4 100)) 3/2 :report "computing the median of a list of numbers")) ;;TODO spread tests ;;TODO quartiles tests ;;; ;;; ttest stuff ;;; ;;TODO test-from-lists tests ;;TODO ttest tests (defun ttest-demo (&optional (fudge 1)) "Implements the demo described at http://www.cas.buffalo.edu/classes/psy/segal/2072001/ttests/t-tests1.html." (let ((one '(105 112 96 124 103 92 97 108 105 110)) (two '( 98 108 114 106 117 118 126 116 122 108))) (setf one (mapcar #'(lambda (x) (* x fudge)) one)) (ttest-from-lists one two))) (addtest ttest (ensure-same (ttest-demo) 0 :report "running a ttest where the means are statistically insignificant") (ensure-same (ttest-demo 1.2) 1 :report "running a ttest where the means are statistically significant")) (addtest tcritical-actual (ensure-same (tcritical 5 95) 2.571 :report "tcritical lookup isn't correct")) (addtest tcritical-interpolate (ensure-same (tcritical 4 99) 4.9365005 :report "tcritical interpolated lookup isn't correct")) (addtest tcritical-unsupported (ensure-error (tcritical 5 80) :report "error not thrown on unsupported lookup confidence")) ;;; report stuff ;;TODO dist tests ;;; ranking stats stuff ;;TODO rank tests