Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sébastien Villemot
antik
Commits
42b2dc4e
Commit
42b2dc4e
authored
Apr 01, 2013
by
Liam M. Healy
Browse files
Merge branch 'newfeature' into systemofunits
Conflicts: antik.asd
parents
250eedb5
8f1a649c
Changes
2
Show whitespace changes
Inline
Sidebyside
antik.asd
View file @
42b2dc4e
;; Antik system definition
;; Liam Healy 20101224 09:43:28EST antik.asd
;; Timestamp: <20130
324 18:32:30
EDT antik.asd>
;; Timestamp: <20130
401 09:16:12
EDT antik.asd>
;; Copyright 2010, 2011, 2012, 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
...
...
@@ 178,7 +178,8 @@
:components
((
:module
optimize
:components
((
:file
"onedim"
)))
((
:file
"onedim"
)
(
:file
"leastsquares"
)))
(
:module
linearalgebra
:components
((
:file
"linearalgebra"
)))
...
...
optimize/leastsquares.lisp
0 → 100644
View file @
42b2dc4e
;; Least squares estimation
;; Liam Healy 20130329 14:16:21EDT leastsquares.lisp
;; Timestamp: <20130329 15:50:57EDT leastsquares.lisp>
;; Copyright 2013 Liam M. Healy
;; Distributed under the terms of the GNU General Public License
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; This requires GSLL
(
inpackage
:antik
)
(
export
'
(
linearleastsquares1d
))
;;;;****************************************************************************
;;;; Linear least squares solver
;;;;****************************************************************************
;;; This should be consistent: now, 'observations is expected to be a list, 'times a grid
(
defun
linearleastsquares1d
(
observations
&optional
(
times
#
m
(
0.0
10.0
20.0
30.0
40.0
)))
"Find the one dimensional least squares (linear regression) solution of slope and intercept.
Values returned: slope, intercept, and their standard errors."
(
metabangbind:bind
(((
:values
intercept
slope
interceptvariance
covariance
slopevariance
sumsquareofresiduals
)
(
gsl:linearfit
times
(
grid:makesimplegrid
:gridtype
'grid:foreignarray
:initialcontents
observations
)))
(
samplevariance
(
/
(
sqrt
sumsquareofresiduals
)
(

(
grid:dim0
observations
)
2
))))
(
declare
(
ignore
covariance
))
(
values
slope
intercept
(
*
samplevariance
(
sqrt
slopevariance
))
(
*
samplevariance
(
sqrt
interceptvariance
)))))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment