6.3.12.1.6. statsmodels.sandbox.distributions.sppatch.fit_fr¶
-
statsmodels.sandbox.distributions.sppatch.
fit_fr
(self, data, *args, **kwds)[source]¶ 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])