Path: news.mathworks.com!not-for-mail
From: "Tom Lane" <tlane@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: fitting Beta CDF
Date: Wed, 26 Sep 2007 13:39:05 -0400
Organization: The MathWorks, Inc.
Lines: 31
Message-ID: <fde5fp$kf2$1@fred.mathworks.com>
References: <fde3o5$dta$1@fred.mathworks.com>
Reply-To: "Tom Lane" <tlane@mathworks.com>
NNTP-Posting-Host: lanet.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1190828346 20962 172.31.57.120 (26 Sep 2007 17:39:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 26 Sep 2007 17:39:06 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3138
Xref: news.mathworks.com comp.soft-sys.matlab:430301



> Are there any function similar to glmfit but for fitting the
> Beta or Gamma CDF.
>
> For example, I have the empirical CDF that I would like to
> fit the Beta or Gamma CDF to.
>
> x = 0:0.1:1.0;
> data = [0.001;0.02;0.15;0.2;0.3;0.45;0.7;0.82;0.9;0.95;0.98;];

Pete, this can be taken different ways.

1.  If you just want to fit a nonlinear function of x to data by least 
squares:

>> x=x';
>> p=nlinfit(x,data,@(b,x)betacdf(x,b(1),b(2)),[1 1])
p =
    2.2548    2.2327
>> plot(x,data,'bo',x,betacdf(x,p(1),p(2)),'r-')

2.  If data represents the empirical cumulative distribution of a sample y, 
do you have y?  Then you could use betafit on y.

3.  If data represents a binomial response for different values of a 
stimulus x, then you could use glmfit.  If data is y./N then you'd need both 
y and N.  You could use the 'link' argument to specify a beta cdf as the 
link function.

-- Tom