A bit more philosophy and task for visualization, in response to Peter S. Still...
[CommonLispStat.git] / examples / 01-basicEDA.lisp
blob96a276f7d74b192cd5132a9fd7243b1fe99a1af3
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2010-06-07 09:29:46 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*
25 ;; Summarize is the basic EDA tool -- it accepts symbols or lists of
26 ;; symbols, to describe what, when, and how to do it. The resulting
27 ;; data structure has a means for re-invoking the result as well as
28 ;; partial storage of key results (when appropriate) as well as
29 ;; metadata about the results (time / context if provided).
31 ;; numerical: (txt / *ml / , variable / stream / spec'd to file)
32 ;; visual: (static/dynamic, fixed/interactive) (need better term than fixed)
34 ;; context -- using dataset metadata, to drive the resulting summary.
35 ;; dataset metadata:
36 ;; #1 sampling scheme -
37 ;; retro / prospect collection
38 ;; random, biased, convenience sampling;
39 ;; #2 purpose of dataset integration/manipulation
40 ;; #3 sampling/temporal component of variables
43 ;; Create metadata variable graph which provides an initial analysis
44 ;; structure for recording results.
46 (defparameter *chkwt-df-depgraph*
47 (let ((g (make-container 'graph-container )))
48 (loop for v in (var-list *chickwt-df*)
49 (add-vertex g v))
50 (loop for (v1 . v2) in (appropriate-pairs-list *chickwt-df*)
51 (add-edge-between-vertexes g v1 v2))))
53 (defparameter *my-df-smry-num*
54 (summarize *chickwts-df* :type 'numerical :io 'listing)
55 "First numerical summary of *my-df-smry*")
57 (defparameter *my-df-smry-num*
58 (summarize *my-df*
59 :type 'numerical
60 :io 'report-pdf
61 :device '(file "output.pdf"))
62 "First numerical summary of *my-df-smry*")
64 (defparameter *my-df-smry-vis*
65 (summarize *my-df*
66 :type 'visual
67 :io 'interactive
68 :device 'xwin)
69 "visual summary")
71 (defparameter *my-df-smry-vis*
72 (summarize *my-df* :type 'visual :io 'interactive-dynamic)
73 "visual summary")
75 (defparameter *my-df-smry-vis*
76 (summarize *my-df* :type 'visual :io 'static)
77 "visual summary")