3 ;;; Time-stamp: <2009-12-13 18:02:13 tony>
4 ;;; Creation: <2009-04-19 09:41:09 tony>
5 ;;; File: linear-regression.lisp
6 ;;; Author: AJ Rossini <blindglobe@gmail.com>
7 ;;; Copyright: (c)2009--, AJ Rossini. BSD, MIT, LLGPL, or
8 ;;; GPLv2+, or GPLv3+ depending on how it arrives.
9 ;;; Purpose: Example of basic linear regression 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.
18 ;; - confirm estimates for multivariate case,
19 ;; - pretty-print output
20 ;; - fix up API -- what do we want this to look like?
23 (regression-model (list->vector-like iron
)
24 (list->vector-like absorbtion
))
28 (lm (list->vector-like iron
)
29 (list->vector-like absorbtion
))
39 (covariance-matrix *m-fit
*)
42 (regression-model (transpose
43 (listoflist->matrix-like
45 :orientation
:row-major
))
46 (list->vector-like absorbtion
)))
48 (defparameter *m3-fit
*
52 ;; Should the above look something like:
53 (defparameter *m3-fit
*
54 (spec-and-fit-model '(absorbtion = iron aluminum
)))
55 ;; in which case we split the list before/after the "=" character.
59 (covariance-matrix *m3-fit
*)
63 ;; now to build a linear regression model from an external CSV datafile...
67 (rsm.string
::file-
>string-table
68 (concatenate 'string
*cls-data-dir
* "file.dsv"))
69 "Initial read-in of data."))
71 (defparameter *my-resp-var
* (slice *my-df
* ))
73 (defparameter *my-pred-vars
* (slice *my-df
* ))