more fleshing out the classes.
[CommonLispStat.git] / src / procedures / procedures.lisp
blob00f40efef92226fd1bb419c588554a46ba0b22bd
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2009-10-09 12:17:47 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 '((interval-estimation
49 (hypothesis-testing ; coarsened interval
50 (frequentist
51 (fisherian
52 (neyman-pearson
53 (wald-test
54 t-test
55 likelihood-ratio-test
56 score-test))))))
57 (point-estimation
58 maximum-likelihood-estimation)
61 optimization
62 root-finding
64 criteria-functions
66 mathematical-forms
69 (defclass statistical-ontology-class ()
71 (:documentation "container class for manipulation of structural components."))
73 (defclass statistical-decision ()
74 ((ontology-classification :initform nil
75 :initarg :ontology-classification
76 :type statistical-ontology-class
78 (:documentation "instance describing the end result, if it is an
79 interval/range/region, or point estimate, or a conclusion from a
80 test (i.e. hypothesis(es) selected, strength of conclusion)"))
82 (defclass statistical-dataset (dataframe-like)
83 (:documentation "a particular dataset, usually the subset from a
84 larger set, which is used as the input to the procedure."))
86 (defclass statistical-metadata (dataframe-like)
87 (:documentation "the description of the dataset's statistical
88 properties which are required for the procedure to work or meet
89 assumptions."))
91 (defclass statistical-procedure ()
92 ((ontological-spec :initform nil
93 :initarg :ontology-def
94 :type list
95 :accessor ontology
96 :documentation "list of symbols describing
97 ontological classification")
98 (how-to-fit)
99 (how-to-simulate)
100 (instance-data)))
102 ;;;
103 (defgeneric proc-consistents-data-p (metadata data)
104 (:documentation "verify that the metadata required for a procedure
105 is present in a particular dataset. The dataset will usually be a
106 subset of the full working dataset."))
108 (defgeneric process-data (proc data)
109 (:documentation "Run the statistical procedure on the dataset and
110 report the decision."))