
zipf(N = NULL, link = "loge", init.s = NULL)
1 < N < Inf
.
The default is to use the maximum value of the response.
If given, N
must be no less that the largest response value.
If N = Inf
and $s>1$ then this is theLinks
for more choices."vglmff"
(see vglmff-class
).
The object is used by modelling functions such as
vglm
and vgam
.
Zipf's law is an experimental law which is often applied
to the study of the frequency of words in a corpus of
natural language utterances. It states that the frequency
of any word is inversely proportional to its rank in the
frequency table. For example, "the"
and "of"
are first two most common words, and Zipf's law states
that "the"
is twice as common as "of"
.
Many other natural phenomena conform to Zipf's law.
dzipf
,
zetaff
.zdata <- data.frame(y = 1:5, ofreq = c(63, 14, 5, 1, 2))
fit <- vglm(y ~ 1, zipf, zdata, trace = TRUE, weight = ofreq, crit = "coef")
fit <- vglm(y ~ 1, zipf(link = identity, init = 3.4), zdata,
trace = TRUE, weight = ofreq)
fit@misc$N
(shat <- Coef(fit))
with(zdata, weighted.mean(y, ofreq))
fitted(fit, matrix = FALSE)
Run the code above in your browser using DataLab