Collection of fitting functions
Determine the best-fit circle to given datapoints.
Parameters: | x : array (N,)
y : array (N,)
|
---|---|
Returns: | center : array (2,)
radius : float
|
Calculates best-fit parameters for the exponential decay to an offset.
Parameters: | tFit : array (N,)
yFit : array (N,)
|
---|---|
Returns: | offset : float
amp : float
tau : float
|
Linear regression fit.
Parameters: | x : ndarray
y : ndarray
alpha : float
newx : float or ndarray
plotFlag: int, optional :
|
---|---|
Returns: | a : float
b : float
ci : ndarray
info : dictionary
newy : list(ndarray)
|
Notes
Example data and formulas are taken from D. Altman, “Practical Statistics for Medicine”
Examples
>>> import numpy as np
>>> from fitLine import fitLine
>>> x = np.r_[0:10:11j]
>>> y = x**2
>>> (a,b,(ci_a, ci_b),_)=fitLine(x,y)
Fit a sine wave with a known frequency to a given set of data.
y = amplitude * sin(2*pi*freq * tList + phase*pi/180) + bias
Parameters: | yList : array
tList : float
freq : float
|
---|---|
Returns: | phase : float
amplitude : float bias : float |
Examples
>>> (phase, amp, offset) = thLib.fitSin.fitSine(t, data, freq)
Linear regression and confidence intervals, for a linear regression y = k * x + d
(kd, ci) = regress(x,y,[alpha=0.05])
Parameters: | x : ndarray (N,)
y : ndarray(N,)
alpha: float :
|
---|---|
Returns: | k : float
d : float
ci : ndarray (2,)
|
See also
Examples
>>> x = arange(100)
>>> y = 0.3*x + 10 + randn(len(x))
>>> (kd, ci) = thLib.fits.regress(x,y)