Commit 8644ef5c authored by Liam M. Healy's avatar Liam M. Healy
Browse files

Correct estimated uncertainty in parameters for linear least squares fit

parent 82bea709
;; Least squares estimation
;; Liam Healy 2013-03-29 14:16:21EDT least-squares.lisp
;; Time-stamp: <2013-03-29 15:50:57EDT least-squares.lisp>
;; Time-stamp: <2013-06-19 15:09:38EDT least-squares.lisp>
;; Copyright 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
......@@ -35,8 +35,8 @@
(metabang-bind:bind
(((:values intercept slope intercept-variance covariance slope-variance sum-square-of-residuals)
(gsl:linear-fit times (grid:make-simple-grid :grid-type 'grid:foreign-array :initial-contents observations)))
(sample-variance (/ (sqrt sum-square-of-residuals) (- (grid:dim0 observations) 2))))
(sample-variance (/ sum-square-of-residuals (- (grid:dim0 observations) 2))))
(declare (ignore covariance))
(values slope intercept
(* sample-variance (sqrt slope-variance))
(* sample-variance (sqrt intercept-variance)))))
(sqrt (* sample-variance slope-variance))
(sqrt (* sample-variance intercept-variance)))))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment