using the t-test, walk through possible inferential APIs, considering whether it...
[CommonLispStat.git] / examples / 50-TTestExample.lisp
blob79ac4277d4d01bbfda099a726f9faeb5a230a7e6
1 ;;; -*- mode: lisp -*-
3 ;;; Time-stamp: <2012-10-12 10:44:00 tony>
4 ;;; Creation: <2009-04-19 09:41:09 tony>
5 ;;; File: t-test-example.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. MIT
8 ;;; Purpose: Example of basic exploratory data analysis in CLS.
10 ;;; What is this talk of 'release'? Klingons do not make software
11 ;;; 'releases'. Our software 'escapes', leaving a bloody trail of
12 ;;; designers and quality assurance people in its wake.
15 ;;; If we can't do a t-test, we can't do anything
17 ;;;; BROKEN!!!
19 (in-package :cls-user)
21 (defparameter *my-df*
22 (make-dataframe
23 (rsm.string::filestream->string-table
24 "/path/to/file.dsv"))
25 "Initial read-in of data.")
28 ;;;; possible APIs...
32 summarize what how send-to
34 what: df, stat-proc
35 how: numerically, visually, all, default
36 send-to: output, file, visual, all, default
39 compare in-model parameters framework philosophy assumptions
41 in-model: regression two-group
42 parameters: means, "explicit choices", variances, means-and-variances, rates, proportions, hazards
43 framework: fisherian, neyman-pearson, empirical-bayes
44 philosophy: frequentist, bayesian, fiducial, decision-theoretic,
45 assumptions: (list 'apply 'ignore 'explore) ; any or all of list entries
48 FIXME: where would empirical bayes go? part is a model, part is a philosophy. framework?
49 FIXME: decision-theoretic adds risk to the decision, making
51 the in-model objects need to be able to reflect their own assumptions and preferences,
53 |#
56 ;;; The traditional intro-stat variant
58 (summarize
59 (compare :parameter 'mean
60 :comparison 'two-groups
61 :group1 datapackage:variable1
62 :group2 datapackage:variable2
63 :assumptions (list 'apply 'ignore 'explore) ; any or all of list entries
65 :resulttype (list 'numerical 'visual)
66 ) ; any or all of list entries
68 ;;; the "know-your-dataset" variant
70 (summarize
71 (compare :parameter 'mean
72 :resulttype (list 'numerical 'visual)
73 :comparison 'two-groups
74 :variable datapackage:comparing-variable ; or response-variable
75 :group-by datapackage:grouping-variable))