added Mirko's suggestions to the TODO list. Needs to be better fleshed out, with...
[CommonLispStat.git] / examples / 10-basicEDA.lisp
blobbefffd5c7089d68690c06f6a54636da91bf8198c
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2012-10-11 16:20:36 tony>
4 ;;; Creation: <2009-04-19 09:41:09 tony>
5 ;;; File: basic-eda.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. See LICENSE.mit in top level
8 ;;; directory for conditions.
9 ;;; Purpose: Example of basic exploratory data analysis in CLS.
11 ;;; What is this talk of 'release'? Klingons do not make software
12 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
13 ;;; designers and quality assurance people in its wake.
15 (in-package :cls-examples)
17 ;; We assume that the "loading-data.lisp" code has been run, and one
18 ;; now wants to analyze the data loaded into *chickwts-df*
20 (load (localized-pathto "examples/00-loadingData.lisp")
21 :verbose t)
23 *chickwts-df*
26 ;;;;;;;;;;;;;;; EVERYTHING BELOW IS BROKEN
28 ;; This is a test philosophy for data analysis from an EDA
29 ;; perspective. It could be expanded to decision support and
30 ;; inferential statistics, but currently is only intended to provide
31 ;; statistically appropriate numerical and visual summaries that are
32 ;; objects that can be manipulated to explore the effect of varying
33 ;; data and metadata.
35 ;; Summarize is the basic EDA tool -- it accepts symbols or lists of
36 ;; symbols, to describe what, when, and how to do it. The resulting
37 ;; data structure has a means for re-invoking the result as well as
38 ;; partial storage of key results (when appropriate) as well as
39 ;; metadata about the results (time / context if provided).
41 ;; numerical: (txt / *ml / , variable / stream / spec'd to file)
42 ;; visual: (static/dynamic, fixed/interactive) (need better term than fixed)
44 ;; context -- using dataset metadata, to drive the resulting summary.
45 ;; dataset metadata:
46 ;; #1 sampling scheme -
47 ;; retro / prospect collection
48 ;; random, biased, convenience sampling;
49 ;; #2 purpose of dataset integration/manipulation
50 ;; #3 sampling/temporal component of variables
53 ;; Create metadata variable graph which provides an initial analysis
54 ;; structure for recording results.
56 (defparameter *chkwt-df-depgraph*
57 (let ((g (make-container 'graph-container )))
58 (loop for v in (var-list *chickwt-df*)
59 (add-vertex g v))
60 (loop for (v1 . v2) in (appropriate-pairs-list *chickwt-df*)
61 (add-edge-between-vertexes g v1 v2))))
63 (defparameter *my-df-smry-num*
64 (summarize *chickwts-df* :type 'numerical :io 'listing)
65 "First numerical summary of *my-df-smry*")
67 (defparameter *my-df-smry-num*
68 (summarize *my-df*
69 :type 'numerical
70 :io 'report-pdf
71 :device '(file "output.pdf"))
72 "First numerical summary of *my-df-smry*")
74 (defparameter *my-df-smry-vis*
75 (summarize *my-df*
76 :type 'visual
77 :io 'interactive
78 :device 'xwin)
79 "visual summary")
81 (defparameter *my-df-smry-vis*
82 (summarize *my-df* :type 'visual :io 'interactive-dynamic)
83 "visual summary")
85 (defparameter *my-df-smry-vis*
86 (summarize *my-df* :type 'visual :io 'static)
87 "visual summary")