smpl.stat¶
Simplified statistics.
Submodules¶
Package Contents¶
Functions¶
|
R2 - Coefficient of determination |
|
Chi2 - Goodness of Fit |
|
|
|
Compute the FFT of |
|
Return interesting xmin and xmax of function |
|
Return mean of |
|
Return |
|
Add gaussian noise to |
|
Return normalized |
|
Return mean of |
|
Return |
|
Returns a function which applies |
Attributes¶
- smpl.stat.R2(y, f)[source]¶
R2 - Coefficient of determination
In the best case, the modeled values exactly match the observed values, which results in R2 = 1. A baseline model, which always predicts the mean of y, will have R2 = 0. Models that have worse predictions than this baseline will have a negative R2.
References¶
- smpl.stat.Chi2(y, f, sigmas=None)[source]¶
Chi2 - Goodness of Fit
In general, if Chi-squared/Nd is of order 1.0, then the fit is reasonably good. Coversely, if Chi-squared/Nd >> 1.0, then the fit is a poor one.
References¶
https://www.phys.hawaii.edu/~varner/PHYS305-Spr12/DataFitting.html
- smpl.stat.fft(y)[source]¶
Compute the FFT of
y.Parameters¶
- yarray_like
Data to be transformed.
Returns¶
array_like
- smpl.stat.get_interesting_domain(f, min_ch=1e-06)[source]¶
Return interesting xmin and xmax of function
f.Examples¶
>>> def f(x): ... return np.sin(x) >>> get_interesting_domain(f) (-3.141625000000003, 3.141625000000003)
- smpl.stat.mean(n)[source]¶
Return mean of
nwith combined error of variance and unvertainties ofn.Parameters¶
- narray_like
Data to be averaged.
Returns¶
- uncertainties.unumpy.uarray
Mean of
n.
Examples¶
>>> n = np.array([1, 2, 3, 4, 5]) >>> mean(n) 3.0+/-1.5811388300841898
- smpl.stat.noisy(x, mean=1, std=0.1)[source]¶
Add gaussian noise to
x.Parameters¶
- xarray_like
Data to be smeared.
- meanfloat
Mean of gaussian noise.
- stdfloat
Standard deviation of gaussian noise.
Returns¶
- array_like
Smeared data.
Examples¶
>>> x = np.array([1, 2, 3, 4, 5]) >>> noisy(x,std=0) array([1., 2., 3., 4., 5.])
- smpl.stat.normalize(ydata)[source]¶
Return normalized
ydata.Parameters¶
- ydataarray_like
Data to be normalized.
Returns¶
- array_like
Normalized data.
Examples¶
>>> ydata = np.array([1, 2, 3, 4, 5]) >>> normalize(ydata) array([0. , 0.25, 0.5 , 0.75, 1. ])