#include <stdio.h>#include <stdlib.h>#include <math.h>#include "include/llsqwt.h"Functions | |
| int | _medianline_cmp (const void *e1, const void *e2) |
| int | llsqwt (double *x, double *y, int n, double *wx, double *wy, double tol, double *w, double *ic, double *slope, double *nwss, double *sic, double *sslope, double *cx, double *cy) |
| int | best_llsqwt (double *x, double *y, double *wx, double *wy, int nr, int min_nr, int mode, double *slope, double *ic, double *nwss, double *sslope, double *sic, double *cx, double *cy, int *bnr) |
| int | llsqperp (double *x, double *y, int nr, double *slope, double *ic, double *ssd) |
| int | llsqperp3 (double *x, double *y, int nr, double *slope, double *ic, double *ssd) |
| int | quadratic (double a, double b, double c, double *m1, double *m2) |
| int | medianline (double *x, double *y, int nr, double *slope, double *ic) |
|
||||||||||||
|
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Finds the best least-squares line to (x,y)-data, leaving points out either from the beginning (mode=0) or from the end (mode=1).
|
|
||||||||||||||||||||||||||||
|
Simple non-iterative perpendicular line fitting. This function is fully based on the article [1]. References: 1. Varga J & Szabo Z. Modified regression model for the Logan plot. J Cereb Blood Flow Metab 2002; 22:240-244.
|
|
||||||||||||||||||||||||||||
|
See llsqperp(). This function accepts data that contains NA's. |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Iterative method for linear least-squares fit with errors in both coordinates. This function is fully based on article [3]. For n data-point pairs (x[i], y[i]) each point has its own weighting factors in (wx[i], wy[i]). This routine finds the values of the parameters m (slope) and c (intercept, ic) that yield the "best-fit" of the model equation Y = mX + c to the data, where X and Y are the predicted or calculated values of the data points. Weighting factors wx and wy must be assigned as the inverses of the variances or squares of the measurement uncertainties (SDs), i.e. w[i]=1/(sd[i])^2 If true weights are unknown but yet the relative weights are correct, the slope, intercept and residuals (WSS) will be correct. The applied term S/(N-2) makes also the estimate of sigma (sd) of slope less dependent on the scaling of weights. The sigmas are not exact, since only the lowest-order terms in Taylor-series expansion are incorporated; anyhow sigmas are more accurate than the ones based on York algorithm. One or more data points can be excluded from the fit by setting either x or y weight to 0. References: 1. York, D. Linear-squares fitting of a straight line. Can. J. Phys. 1966;44:1079-1086. 2. Lybanon, M. A better least squares method when both variables have uncertainties. Am. J. Phys. 1984;52:22-26 and 276-278. 3. Reed BC. Linear least-squares fits with errors in both coordinates. II: Comments on parameter variances. Am. J. Phys. 1992;60:59-62.
|
|
||||||||||||||||||||||||
|
Median-based distribution-free estimation of slope and intercept. This method has no need for weighting and is insensitive to outliers. Note that this is not LMS ! Reference (containing reference to the original idea): 1. Siegel AF. Robust regression using repeated medians. Biometrika 1982; 69(1):242-244.
|
|
||||||||||||||||||||||||
|
Finds the real roots of a*x^2 + b*x + c = 0
|
1.4.1