I need to fit a custom probability density (based on the symmetric beta
distribution B(shape, shape), where the two parameters shape1 and shape2
are identical) to my data.
The trouble is that I experience some problems also when dealing with the
plain vanilla symmetric beta distribution.
Please consider the code at the end of the email.
In the code, dbeta1 is the density of the beta distribution for
In the code, dbeta2 is the same quantity written explicitly, without the
normalization factor (which should not matter at all if we talk about
maximizing a quantity).
I then generate some random numbers according to Beta(0.2, 0.2) and I try
to estimate the shape parameter using
1) fitdistr from MASS
2) mle from stats4
Results: generally speaking I have non-sense estimates of the shape
parameter when I use dbeta2 instead of dbeta1 and I do not understand why.
On top of that, mle crashes with dbeta2 and often I have numerical problems
depending on how I seed the x sequence of random numbers.
I must be misunderstanding something, so any suggestion is appreciated.