[Scipy-tickets] [SciPy] #832: allow partially frozen parameters in distributions fit

SciPy scipy-tickets@scipy....
Wed Dec 31 22:24:22 CST 2008


#832: allow partially frozen parameters in distributions fit
-------------------------+--------------------------------------------------
 Reporter:  josefpktd    |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:  0.8.0   
Component:  scipy.stats  |     Version:  devel   
 Severity:  normal       |    Keywords:          
-------------------------+--------------------------------------------------
 For distributions with a finite bound, the maximum likelihood estimator
 shifts the support of the distribution when choosing the location
 parameter. It might be useful for applications, to estimate the
 distribution parameters keeping the support as fixed. This requires that
 the location parameter is not estimated, but kept fixed at a predefined
 level. A new partially frozen fit method (or keyword option to current fit
 method) would then be helpful.

 Example: exponential and gamma

 lower bound:
 {{{
 >>> stats.expon.a
 0.0
 >>> stats.gamma.a
 0.0
 }}}

 When the distribution parameters are estimated the estimated location is
 equal to the
 minimum of the sample with a small sample:

 {{{
 >>> rvse = stats.expon.rvs(scale=20,size=10)
 >>> rvse.min()
 0.16659953684902068
 >>> stats.expon.fit(rvse)
 array([  0.16659954,  17.22700066])

 >>> rvsg = stats.gamma.rvs(2.5,scale=20,size=10)
 >>> rvsg.min()
 2.2759635436150862
 >>> stats.gamma.fit(rvsg)
 array([  0.79189313,   2.27596354,  50.24691982])
 }}}

 With a larger sample the effect is not as strong, but the estimate of the
 distribution parameters looks closer to the true value, when the the
 support is not
 estimated:

 {{{
 >>> rvsg = stats.gamma.rvs(2.5,scale=20,size=500)
 >>> stats.gamma.fit(rvsg)
 array([  1.94870102,   3.02757075,  23.34045526])
 >>> rvsg.min()
 4.7640830982763855

 >>> rvsg2 = np.r_[rvsg,1e-10]
 >>> rvsg2.min()
 1e-010
 >>> stats.gamma.fit(rvsg2)
 array([  2.45961754,  -1.04670729,  20.10925936])
 }}}

 This is still true for a sample size of 5000, at least for the non-
 location parameters:

 {{{
 >>> rvsg = stats.gamma.rvs(2.5,scale=20,size=5000)
 >>> stats.gamma.fit(rvsg)
 array([  2.35574021,   0.33786718,  21.06022181])
 >>> rvsg.min()
 1.5893540665741748

 >>> rvsg2 = np.r_[rvsg,1e-10]
 >>> stats.gamma.fit(rvsg2)
 array([  2.44583532,  -0.35044246,  20.56178345])
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/832>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list