0.6.2-dev0
FORCES
FORtran lib for Comp. Env. Sys.
Loading...
Searching...
No Matches
mo_linfit::linfit Interface Reference

Fits a straight line to input data by minimizing chi^2. More...

Public Member Functions

real(sp) function, dimension(:), allocatable linfit_sp (x, y, a, b, siga, sigb, chi2, model2)
 
real(dp) function, dimension(:), allocatable linfit_dp (x, y, a, b, siga, sigb, chi2, model2)
 

Detailed Description

Fits a straight line to input data by minimizing chi^2.

Given a set of data points x(1:ndata), y(1:ndata), fit them to a straight line \( y = a+bx \) by minimizing chi2.
Model I minimizes y vs. x while Model II takes the geometric mean of y vs. x and x vs. y. Returned is the fitted line at x. Optional returns are a, b and their respective probable uncertainties siga and sigb, and the chi-square chi2.

Parameters
[in]real(sp/dp) :: x(:)1D-array with input x
[in]real(sp/dp) :: y(:)1D-array with input y
[in]logical, optional :: model2If present, use geometric mean regression instead of ordinary least square
[out]real(sp/dp), dimension(M) :: aintercept
[out]real(sp/dp), dimension(M) :: bslope
[out]real(sp/dp), dimension(M) :: sigaerror on intercept
[out]real(sp/dp), dimension(M) :: sigberror on slope
[out]real(sp/dp) :: chisqMinimum chi^2
Returns
real(sp/dp), dimension(:), allocatable :: out — fitted values at x(:).

Definition at line 84 of file mo_linfit.f90.

Member Function/Subroutine Documentation

◆ linfit_dp()

real(dp) function, dimension(:), allocatable mo_linfit::linfit::linfit_dp ( real(dp), dimension(:), intent(in)  x,
real(dp), dimension(:), intent(in)  y,
real(dp), intent(out), optional  a,
real(dp), intent(out), optional  b,
real(dp), intent(out), optional  siga,
real(dp), intent(out), optional  sigb,
real(dp), intent(out), optional  chi2,
logical, intent(in), optional  model2 
)

Definition at line 98 of file mo_linfit.f90.

◆ linfit_sp()

real(sp) function, dimension(:), allocatable mo_linfit::linfit::linfit_sp ( real(sp), dimension(:), intent(in)  x,
real(sp), dimension(:), intent(in)  y,
real(sp), intent(out), optional  a,
real(sp), intent(out), optional  b,
real(sp), intent(out), optional  siga,
real(sp), intent(out), optional  sigb,
real(sp), intent(out), optional  chi2,
logical, intent(in), optional  model2 
)

Definition at line 189 of file mo_linfit.f90.


The documentation for this interface was generated from the following file: