6.3.14.2.5.1.7. statsmodels.sandbox.distributions.transformed.Transf_gen.fit_fr

Transf_gen.fit_fr(data, *args, **kwds)

estimate distribution parameters by MLE taking some parameters as fixed

Parameters:

data : array, 1d

data for which the distribution parameters are estimated,

args : list ? check

starting values for optimization

kwds :

  • ‘frozen’
    : array_like

    values for frozen distribution parameters and, for elements with np.nan, the corresponding parameter will be estimated

Returns:

argest : array

estimated parameters

Notes

self is an instance of a distribution class. This can be attached to scipy.stats.distributions.rv_continuous

Todo

  • check if docstring is correct
  • more input checking, args is list ? might also apply to current fit method

Examples

generate random sample >>> np.random.seed(12345) >>> x = stats.gamma.rvs(2.5, loc=0, scale=1.2, size=200)

estimate all parameters >>> stats.gamma.fit(x) array([ 2.0243194 , 0.20395655, 1.44411371]) >>> stats.gamma.fit_fr(x, frozen=[np.nan, np.nan, np.nan]) array([ 2.0243194 , 0.20395655, 1.44411371])

keep loc fixed, estimate shape and scale parameters >>> stats.gamma.fit_fr(x, frozen=[np.nan, 0.0, np.nan]) array([ 2.45603985, 1.27333105])

keep loc and scale fixed, estimate shape parameter >>> stats.gamma.fit_fr(x, frozen=[np.nan, 0.0, 1.0]) array([ 3.00048828]) >>> stats.gamma.fit_fr(x, frozen=[np.nan, 0.0, 1.2]) array([ 2.57792969])

estimate only scale parameter for fixed shape and loc >>> stats.gamma.fit_fr(x, frozen=[2.5, 0.0, np.nan]) array([ 1.25087891])