MonteCarlo

 
MonteCarlo = class MonteCarlo(builtins.object)
    MonteCarlo(xdata, model, covariance, index=None, seed=12345, mcycles=25)
 
Helper class to calculate the confidence region of a fitted model.
 
MonteCarlo for models.
 
The MonteCarlo class is to be used in conjunction with Model classes.
 
Author:      Do Kester
 
Attributes
----------
xdata : array_like
    array of independent input values
model : Model
    the model function to be fitted
mcycles : int
    Sets number of cycles in the MonteCarlo procedure to estimate
    error bars. Default = 25
 
Hidden Attributes
-----------------
_eigenvectors : array_like (read only)
    from eigenvalue decomposition of covariance matrix
_eigenvalues : array_like (read only)
    from eigenvalue decomposition of covariance matrix
_random : random
    random number generator
 
  Constructor:
MonteCarlo( xdata, model, covariance, index=None, seed=12345, mcycles=25)
Create a new MonteCarlo, providing inputs and model.
 
A MonteCarlo object is defined by its model and the input vector (the
independent variable). When a fit to another model and/or another
input vector is needed a new object should be created.
 
Parameters
----------
xdata : array_like
    array of independent input values
model : Model
    the model function to be fitted
covariance : matrix
    the covariance matrix of the problem. Default from the Model.
index : list of int
    indices of parameters to fit
seed : int
    seed for random number generator
mcycles : int
    number of cycles in the MonteCarlo procedure to estimate error bars.
 
Raises
------
ValueError when model and input have different dimensions
Methods defined here:
decompose( covariance )
getError( xdata=None )
Calculates 1 σ-confidence regions on the model given some inputs.
 
From the full covariance matrix ( = inverse of the Hessian ) random
samples are drawn, which are added to the parameters. With this new
set of parameters the model is calculated. This procedure is done
by default, 25 times.
The standard deviation of the models is returned as the error bar.
 
Parameters
----------
xdata ; array_like
    input data over which to calculate the error bars. default provided xdata
randomVariant( xdata )
Return a random variant of the model result.
Taking into account the stdev of the parameters and their covariance.
 
Parameters
----------
xdata : array_like
    input data at these indpendent points