# [SciPy-User] Can I "fix" scale=1 when fitting distributions?

David Ho itsdho@ucla....
Tue Apr 13 23:09:47 CDT 2010

```Actually, being able to "fix" scale=1 would be very useful for me.

The reason I'm trying to fit a von mises distribution to my data is to find
"kappa", a measure of the concentration of the data.

On wikipedia, I see that the von mises distribution only really has 2
parameters: mu (the mean), and kappa (1/kappa being analogous to the
variance).
When I use vonmises.fit(), though, I get 3 parameters: kappa, mu, and a
"scale parameter", respectively.
However, I don't think the scale parameter for the von mises distribution is
really independent of kappa, is it? (Am I understanding this correctly?)
(Using the normal distribution as a comparison, I think the "scale
parameter" for a normal distribution certainly isn't independent of sigma,
and norm.fit() only returns mu and sigma. This makes a lot more sense to
me.)

I'm basically trying to use kappa as a measure of the "width" of the
distribution, so the extra degree of freedom introduced by the scale
parameter is problematic for me. For two distributions that are
superficially very similar in "width", I might get wildly varying values of
kappa.

For example, I once got fitted values of kappa=1, and kappa=400 for two
distributions that looked very similar in width.
I thought I must have been doing something wrong... until I saw the scale
parameters were around 1 and 19, respectively.
Plotting the fitted distributions:
>>> xs = numpy.linspace(-numpy.pi, numpy.pi, 361)
>>> plot(xs, scipy.stats.distributions.vonmises.pdf(xs, 1, loc=0, scale=1))
>>> plot(xs, scipy.stats.distributions.vonmises.pdf(xs, 400, loc=0,
scale=19))

What I'd really like to do is "force" scale=1 when I perform the fitting.
(In fact, it would be nice to even force the mean of the fitted distribution
to a precalculated value, as well. I really only want one degree of freedom
for the fitting algorithm -- I just want it to explore different values of
kappa.)

Is there any way to do this?

--David Ho

On Tue, Apr 13, 2010 at 3:13 PM,  <josef.pktd@gmail.com> wrote:
>  > In the current fit version, loc (and with it the support of the
> > distribution) and scale are always estimated. In some cases this is
> > not desired.
> > You are transforming the original data to fit into the standard
> > distribution with loc=0, scale=1 . Do you get reasonable estimates for
> > loc and scale in this case?
> > If not, then there is another patch or enhanced fit function that
> > could take loc and scale as fixed.
> >
> > I will look at some details in your function later, especially I'm
> > curious how the circular statistics works.
> >
> > Thanks for the example, maybe I can stop ignoring vonmises.
> >
> > Josef
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20100413/4b1587eb/attachment.html
```