[R] Zeta and Zipf distribution

Mauro Rossi Mauro.Rossi at irpi.cnr.it
Fri Feb 9 17:12:09 CET 2007


Thank you David,
	I've followed you example and I found the parameters I need. I also 
write a script using zetaff distribution and also this works well.

Thank you again,

Mauro

David Barron ha scritto:
> I don't claim to be a huge expert on this, but I think you are mistaken
> about what you are getting when you use the zipf family with the vglm
> function.  From what I can tell from the documentation, this does indeed
> give you an estimate of the parameter of the zipf distribution.  I've tried
> to "test" this using some random numbers (probably not strictly correct
> procedure, but I think it's a reasonable approximation):
> 
> set.seed(1234)
>  N <- 5
>   y <- (1:N)
>   alpha <- 2.5  # this is the parameter of the zipf distribution
>   p <- 1/(y^alpha) ; p <- p/sum(p)
>   n <- 100000
>   x <- sample (y, n, replace=TRUE, prob=p)
> w <- as.vector(table(x))
> fit = vglm  (y ~ 1, zipf(link=identity, init=2), tra=TRUE, weight=w)
>> Coef(fit)
> 
>        s
> 2.501086
> 
> Is this not what you need?
> 
> On 08/02/07, Mauro Rossi <Mauro.Rossi a irpi.cnr.it> wrote:
>> Dear David,
>>         thank you for your reply.
>> I tried to use the package VGAM, the function "zipf" and also the
>> function "zetaff", but these functions don't allow me to estimate
>> parameters directly, I have to use a Gerneralized Linear Model or a
>> Generalized Additive Model (vgam or vglm functions) and I don't want to
>> use those. Don't you know a way to apply these tools to my data?
>> At the end my PMF has to be Y=f(X) where f(X) is a zeta or a zipf
>> distribution, while using VGAM the PMF is Y = b0 + b1*f(X1)+ ...
>> +bn*f(Xn). Do you know how I can write the script using the VGAM
>> function for the PMF I need?
>>
>> Thank you in advance,
>>
>> Mauro Rossi
>>
>>
>> David Barron ha scritto:
>>> Does the zipf function in the VGAM package do what you want?
>>>
>>> On 08/02/07, *Mauro Rossi* <Mauro.Rossi a irpi.cnr.it
>>> <mailto:Mauro.Rossi a irpi.cnr.it>> wrote:
>>>
>>>     Dear R user,
>>>     I want to estimate the parameter of ZETA or/and ZIPF distributions
>>>     using R, given a series of integer values. Do you know a package
>>>     (similar to MASS) or a function (similar to fitdistr) I can use to
>>>     estimate the parameter of these distributions using MLE method?
>>>     Otherwise do you know a function (which use MLE method to estimate
>>>     distribution parameters) that allow me to specify a PDF or PMF?
>>>     Thanks,
>>>     Regards
>>>     Mauro Rossi
>>>
>>>     --
>>>     Mauro Rossi
>>>     Istituto di Ricerca per la Protezione Idrogeologica
>>>     Consiglio Nazionale delle Ricerche
>>>     Via della Madonna Alta, 126
>>>     06128 Perugia
>>>     Italia
>>>     Tel. +39 075 5014421
>>>     Fax +39 075 5014420
>>>
>>>     ______________________________________________
>>>     R-help a stat.math.ethz.ch <mailto:R-help a stat.math.ethz.ch> mailing
>> list
>>>     https://stat.ethz.ch/mailman/listinfo/r-help
>>>     PLEASE do read the posting guide
>>>     http://www.R-project.org/posting-guide.html
>>>     <http://www.R-project.org/posting-guide.html>
>>>     and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>>
>>>
>>> --
>>> =================================
>>> David Barron
>>> Said Business School
>>> University of Oxford
>>> Park End Street
>>> Oxford OX1 1HP
>> --
>> Mauro Rossi
>>
>> Istituto di Ricerca per la Protezione Idrogeologica
>>
>> Consiglio Nazionale delle Ricerche
>>
>> Via della Madonna Alta, 126
>>
>> 06128 Perugia
>>
>> Italia
>>
>> Tel. +39 075 5014421
>>
>> Fax +39 075 5014420
>>
>>
>>
> 
> 

-- 
Mauro Rossi

Istituto di Ricerca per la Protezione Idrogeologica

Consiglio Nazionale delle Ricerche

Via della Madonna Alta, 126

06128 Perugia

Italia

Tel. +39 075 5014421

Fax +39 075 5014420



More information about the R-help mailing list