Package ivs :: Package statistics :: Module linearregression :: Class PolynomialModel
[hide private]
[frames] | no frames]

Class PolynomialModel

source code


Class to implement a polynomial model

The class implements a polynomial model function of the form

y(x) = a_0 * a_1 * x + a_2 * x^2 + ...

where y are the responses (observables), x are the covariates, the a_i are the regression coefficients (to be determined). Such a class provides convenient way of creating a polynomial model.

Remarks:

Instance Methods [hide private]
PolynomialModel
__init__(self, covariate, covariateName, orderList, covMatrix=None)
Initialiser of the PolynomialModel class.
source code

Inherited from LinearModel: __add__, __str__, conditionNumber, containsRegressorName, copy, degreesOfFreedom, designMatrix, fitData, hatMatrix, nObservations, nParameters, pseudoInverse, regressorNames, singularValues, someRegressorNameContains, standardCovarianceMatrix, submodels, traceHatMatrix, withIntercept

Inherited from LinearModel (private): _singularValueDecompose

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, covariate, covariateName, orderList, covMatrix=None)
(Constructor)

source code 

Initialiser of the PolynomialModel class.

Example:

>>> time = linspace(0,10,100)
>>> pm = PolynomialModel(time, "t", [2,1])
Parameters:
  • covariate (ndarray) - an array of size N with the covariate values, where N is the number of observations
  • covariateName (string) - the (preferably short) name of the covariate. E.g. "t", or "x".
  • orderList (list) - list of the orders that should be included in the model. E.g. [3,0,1] implies the model a_0 * x^3 + a_1 + a_2 * x
  • covMatrix (ndarray) - square array containing the covariance matrix of the observations. This way, weights and correlations can be taken into account.
Returns: PolynomialModel
an instance of PolynomialModel, subclass of LinearModel
Overrides: object.__init__