Thread Subject: Fitting CDF of Beta distribution data

Subject: Fitting CDF of Beta distribution data

From: Pete sherer

Date: 20 May, 2008 18:07:03

Message: 1 of 4

Right now I am fitting the CDF data using the normal
distribution via the GLMFIT. Are there any way I can do the
same fitting but assuming the BETA distribution.

The current code I am using to fit Normal CDF data is as
shown below:
x = [0.1294;0.2211;0.3779;0.5559;0.7034;0.8901;1.1263;];
y = [0;0;0.004;0.007;0.029;0.078;0.192;];

Y = roundn( [y*100 100*ones(length(y), 1)], 0);
b = glmfit( x, Y, 'binomial', 'link', 'probit');

% Equivalent Normal parameters are (From Tom Lane):
mean = -b(1)/b(2);
stdDev = 1/b(2);

Thank you very much for your help,

Subject: Fitting CDF of Beta distribution data

From: Tom Lane

Date: 22 May, 2008 01:15:31

Message: 2 of 4

Pete, with the "probit" link function you are saying the binomial
probabilities follow the form of a normal cdf. The b(1) and b(2) parameters
adjust the mean and standard deviation of the distribution function.

That's not the case with a beta distribution. It's not a location/scale
family. It would be possible to use a beta distribution function with
parameters that you specify in advance, and then let the b(1) and b(2)
parameters define a location/scale transformation of that. I'll bet that's
not what you intend, though. Also, unlike the normal, this distribution has
zero probability outside a finite range; this may or may not cause troubles
for you..

I can't think of any way to use glmfit and estimate the beta function
parameters. I have seen work people have done to estimate parameters in a
link function. If that's what you really want, let me know. Maybe I can
find a reference.

-- Tom

"Pete sherer" <tsh@abg.com> wrote in message
news:g0v407$9e9$1@fred.mathworks.com...
> Right now I am fitting the CDF data using the normal
> distribution via the GLMFIT. Are there any way I can do the
> same fitting but assuming the BETA distribution.
>
> The current code I am using to fit Normal CDF data is as
> shown below:
> x = [0.1294;0.2211;0.3779;0.5559;0.7034;0.8901;1.1263;];
> y = [0;0;0.004;0.007;0.029;0.078;0.192;];
>
> Y = roundn( [y*100 100*ones(length(y), 1)], 0);
> b = glmfit( x, Y, 'binomial', 'link', 'probit');
>
> % Equivalent Normal parameters are (From Tom Lane):
> mean = -b(1)/b(2);
> stdDev = 1/b(2);
>
> Thank you very much for your help,

Subject: Fitting CDF of Beta distribution data

From: Pete sherer

Date: 22 May, 2008 02:30:21

Message: 3 of 4

Hi Tom,

It doesn't have to use the GLMFIT. Any function that can be
used to estimate the parameters of beta distribution would do.

Thanks a lot.

Pete

Subject: Fitting CDF of Beta distribution data

From: Tom Lane

Date: 22 May, 2008 15:26:14

Message: 4 of 4

> It doesn't have to use the GLMFIT. Any function that can be
> used to estimate the parameters of beta distribution would do.

Okay, Pete. Usually I tell people that they need to be clear about whether
to approach something as a distribution fitting problem or a curve fitting
problem. Let's just say you have a curve fitting problem, which just
happens to use a curve in the form of a distribution function.

Your largest x value is bigger than 1. So the beta distribution on [0,1] is
not appropriate. Let's say you have a beta distribution with parameters A
and B on the interval [0,C] where there are now three parameters to
estimate. Here's one way of going about that. I exponentiated all the
parameters just as a convenient way to force them to be positive.

I hope this is enough to get you started.

-- Tom

x = [0.1294;0.2211;0.3779;0.5559;0.7034;0.8901;1.1263;];
y = [0;0;0.004;0.007;0.029;0.078;0.192;];

f = @(p,x) betacdf(x/exp(p(1)),exp(p(2)),exp(p(3)));

p = nlinfit(x,y,f,[2 1 1])
fmt = 'Beta distributionon on [0,%g] with parameters %g and %g \n',...
t = sprintf(fmt, exp(p));

xx = linspace(0,1.2);
plot(x,y,'bo',xx,f(p,xx),'r-')
title(t)

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com