[R] Zipf distribution fitting with VGAM

zhyzhou zhyzhou at mail.ustc.edu.cn
Thu May 15 10:40:24 CEST 2008


Dear R users:

I want to fit my data with zipf distribution using VGAM package, I used the
following script:
	w<-read.csv("the data file path")
	y<-1:length(w)
	fit = vglm(y ~ 1, zipf(link=identity, init=0.5), tra=TRUE, weight=w)

After run it, I encountered the problem : gharmonic(extra$N, s = ss - 1) :
bad input for argument "s"

After that, i use the following script to generate a series of data that
obey zipf distribution:

N<-5
y<-1:N
zipf.data<-(y^(-0.5))/sum((1:N)^(-0.5))

and use the zipf.data as the weights, run the following script:

fit = vglm  (y ~ 1, zipf(link=identity), tra=TRUE, weight=zipf.data) 

i still got the error: gharmonic(extra$N, s = ss - 1) : bad input for
argument "s"

How to fix the problem. I only want to fit my data with zipf distribution
and get the para s.

Thanks in advance.
-- 
View this message in context: http://www.nabble.com/Zipf-distribution-fitting-with-VGAM-tp17248345p17248345.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list