fixed up variables to match the load. Example dependency graph crafted, but need...
[CommonLispStat.git] / examples / 01-basicEDA.lisp
blobbdebf0f82dfbfb80172be99035c21e8ccbf4140f
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2010-03-03 16:22:26 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 "loading-data.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
41 ;;
43 (defparameter *chkwt-df-depgraph*
44 (let ((g (make-container 'graph-container )))
45 (loop for v in (var-list *chickwt-df*)
46 (add-vertex g v))
47 (loop for (v1 . v2) in (appropriate-pairs-list *chickwt-df*)
48 (add-edge-between-vertexes g v1 v2))))
50 (defparameter *my-df-smry-num*
51 (summarize *chickwts-df* :type 'numerical :io 'listing)
52 "First numerical summary of *my-df-smry*")
54 (defparameter *my-df-smry-num*
55 (summarize *my-df*
56 :type 'numerical
57 :io 'report-pdf
58 :device '(file "output.pdf"))
59 "First numerical summary of *my-df-smry*")
61 (defparameter *my-df-smry-vis*
62 (summarize *my-df*
63 :type 'visual
64 :io 'interactive
65 :device 'xwin)
66 "visual summary")
68 (defparameter *my-df-smry-vis*
69 (summarize *my-df* :type 'visual :io 'interactive-dynamic)
70 "visual summary")
72 (defparameter *my-df-smry-vis*
73 (summarize *my-df* :type 'visual :io 'static)
74 "visual summary")