Hi there, I haven't seen any answers to your question on the list, so here's a rather late response.
I'm not familiar with the VGAM package, but if you just want to fit Zipf's law (did you mean Zipf's law or an actual probability distribution?) to some data, why not do this directly with nls() or optim()? If you pass the Zipf equation to those functions, they should give you estimates for the parameters you're interested in. If you're particularly interested in low-frequency data (i.e. the long tail of the Zipf ranking) and actual probability distributions, you could try our "zipfR" package available from CRAN. The tutorial and background materials at http://zipfR.R-Forge.R-project.org/ should help you to get started and will also explain how to calculate the coefficients of Zipf's law from estimates of the model parameters. Best regards, Stefan Evert [ stefan.ev...@uos.de | http://purl.org/stefan.evert ] On 27 Dec 2008, at 10:01, Epithemeus wrote: > Dear R-users, > > I am new to R and would like to use it for fitting the zipf > distribution to > some numeric data that I have. Here's the snippet that I use: > > library(VGAM) > > X <- read.table(file("~\\mydata.txt", encoding="latin1")) > > w <- as.vector(t((X[2]))) > > w <- w/sum(w) > > y <- (1:length(w)) > > fit = vglm (y ~ 1, zipf, tra=TRUE, weight=w) > > zipf(N=NULL, link="loge", earg=w, init.s=NULL) > > coef(fit, matrix=FALSE) [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.