working through the statistical procedures structure. Unlike R, any new statistical...
[CommonLispStat.git] / src / procedures / procedures.lisp
blob8c65354cba4df763fe773274743b285545e67c9a
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-10-09 12:02:09 tony>
4 ;;; Creation: <2009-03-12 17:14:56 tony>
5 ;;; File: procedures.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. Currently licensed under MIT
8 ;;; license. See file LICENSE.mit in top-level directory
9 ;;; for information.
10 ;;; Purpose: Classes for statistical procedures, and generics
11 ;;; supporting use of such procedures.
13 ;;; What is this talk of 'release'? Klingons do not make software
14 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
15 ;;; designers and quality assurance people in its wake.
17 ;;; This organization and structure is new to the 21st Century
18 ;;; version.. Think, "21st Century Schizoid Man".
20 (in-package :cls-statproc)
22 ;;; Statistical procedures can consist of one or more of:
24 ;;; - mathematical forms: linear predictors, splines, functional
25 ;;; forms) which get spliced together.
27 ;;; - criteria functions (likelihoods, sum-of-squares, information), params and data.
28 ;;; - optimization algorithmsfunctions
30 ;;; - root functions (score functions, influence functions), params and data
31 ;;; - zero-finding algorithms
33 ;;; - point estimate: special case of...
34 ;;; - interval estimation (with uncertainty criteria to support range or point)
35 ;;; - hypothesis test -- which can be thought of as a point estimator
36 ;;; for a coarsened problem, or as a simple interval-based decision with
37 ;;; uncertanty criteria.
39 ;;; Estimators are reaasonably straightforward. Either we are
40 ;;; providing a point estimate, or we provide an interval estimate.
41 ;;; But shouldn't these be characterized in the same manner?
43 ;;; We are currently building up an ontology (ADG/DAG) or
44 ;;; knowledge-base whose leaves are described by the path to them.
46 (defvar *statistical-procedure-components*
47 '(wald-test
48 t-test
49 likelihood-ratio-test
50 score-test
52 optimization
53 root-finding
55 criteria-functions
57 mathematical-forms
61 (defclass statistical-decision ()
62 (:documentation "instance describing the end result, if it is an
63 interval/range/region, or point estimate, or a conclusion from a
64 test (i.e. hypothesis(es) selected, strength of conclusion)"))
66 (defclass statistical-dataset (dataframe-like)
67 (:documentation "a particular dataset, usually the subset from a
68 larger set, which is used as the input to the procedure."))
70 (defclass statistical-metadata (dataframe-like)
71 (:documentation "the description of the dataset's statistical
72 properties which are required for the procedure to work or meet
73 assumptions."))
75 (defclass statistical-procedure ()
76 ((ontological-spec :initform nil
77 :initarg :ontology-def
78 :type list
79 :accessor ontology
80 :documentation "list of symbols describing
81 ontological classification")
82 (how-to-fit)
83 (how-to-simulate)
84 (instance-data)))
86 ;;;
87 (defgeneric proc-consistents-data-p (metadata data)
88 (:documentation "verify that the metadata required for a procedure
89 is present in a particular dataset. The dataset will usually be a
90 subset of the full working dataset."))
92 (defgeneric process-data (proc data)
93 (:documentation "Run the statistical procedure on the dataset and
94 report the decision."))