
StatsModels: Statistics in Python — statsmodels 0.8.0 documentation statsmodels is a Python module that provides classes and functions for the estimation of many different statistical models, as well as for conducting statistical tests, and statistical data exploration. An extensive list of result statistics are available for each estimator. The results are tested against existing statistical packages to ensure that they are correct. The package is released under the open source Modified BSD (3-clause) license. The online documentation is hosted at statsmodels.org. Since version 0.5.0 of statsmodels, you can use R-style formulas together with pandas data frames to fit your models. You can also use numpy arrays instead of formulas: Have a look at dir(results) to see available results.
SciPy Getting Started This page is intended to help the beginner get a handle on SciPy and be productive with it as fast as possible. What are NumPy, SciPy, matplotlib, ...? SciPy and friends can be used for a variety of tasks: NumPy‘s array type augments the Python language with an efficient data structure useful for numerical work, e.g., manipulating matrices. NumPy also provides basic numerical routines, such as tools for finding eigenvectors.SciPy contains additional routines needed in scientific work: for example, routines for computing integrals numerically, solving differential equations, optimization, and sparse matrices.The matplotlib module produces high quality plots. With it you can turn your data or your models into figures for presentations or articles. How to work with SciPy Python is a programming language, and there are several ways to approach it. The most common is to use the advanced interactive Python shell IPython to enter commands and run scripts. Learning to work with SciPy
SymPy wikipedia numpy Traits[edit] The ndarray data structure[edit] The core functionality of NumPy is its "ndarray", for n-dimensional array, data structure. These arrays are strided views on memory.[2] In contrast to Python's built-in list data structure (which, despite the name, is a dynamic array), these arrays are homogeneously typed: all elements of a single array must be of the same type. Such arrays can also be views into memory buffers allocated by C, C++. Limitations[edit] NumPy's arrays must be views on contiguous memory buffers. Algorithms that are not expressible as vectorized operation will typically run slowly because they must be implemented in "pure Python", while vectorization may increase memory complexity of some operations from constant to linear, because temporary arrays must be created that are as large as the inputs. Examples[edit] Array Creation Basic Operations Universal Functions >>> a = np.linspace(-np.pi, np.pi, 100) >>> b = np.sin(a)>>> c = np.cos(a) Linear Algebra History[edit]
Non-Linear Least-Squares Minimization and Curve-Fitting for Python — Non-Linear Least-Squares Minimization and Curve-Fitting for Python Lmfit provides a high-level interface to non-linear optimization and curve fitting problems for Python. It builds on and extends many of the optimization methods of scipy.optimize. Initially inspired by (and named for) extending the Levenberg-Marquardt method from scipy.optimize.leastsq, lmfit now provides a number of useful enhancements to optimization and data fitting problems, including: Using Parameter objects instead of plain floats as variables. The lmfit package is Free software, using an Open Source license.
Notes numpy.poly1d A one-dimensional polynomial class. A convenience class, used to encapsulate “natural” operations on polynomials so that said operations may take on their customary form in code (see Examples). Examples Construct the polynomial >>> p = np.poly1d([1, 2, 3])>>> print np.poly1d(p) 21 x + 2 x + 3 Evaluate the polynomial at Find the roots: >>> p.rarray([-1.+1.41421356j, -1.-1.41421356j])>>> p(p.r)array([ -4.44089210e-16+0.j, -4.44089210e-16+0.j]) These numbers in the previous line represent (0, 0) to machine precision Show the coefficients: Display the order (the leading zero-coefficients are removed): Show the coefficient of the k-th power in the polynomial (which is equivalent to p.c[-(i+1)]): Polynomials can be added, subtracted, multiplied, and divided (returns quotient and remainder): >>> p * ppoly1d([ 1, 4, 10, 12, 9]) >>> (p**3 + 4) / p(poly1d([ 1., 4., 10., 12., 9.]), poly1d([ 4.])) asarray(p) gives the coefficient array, so polynomials can be used in all functions that accept arrays: Attributes
Polynomial vs poly1d