YuleSimon: (Weighted) MLE of Yule-Simon Distribution

Description Usage Arguments Value Author(s) Examples

View source: R/YuleSimon.R

Description

Yule-Simon distribution is characterized by the following probability mass function,

f(x;ρ) = ρ B (x, ρ+1)

where the domain is positive integers x \in \lbrace 1,2,… \rbrace with the shape parameter ρ > 0.

Usage

1
YuleSimon(x, weight = NULL)

Arguments

x

a length-n vector of positive integers.

weight

a length-n weight vector. If set as NULL, it gives an equal weight, leading to standard MLE.

Value

a named list containing (weighted) MLE of

rho

shape parameter.

Author(s)

Kisung You

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#  generate data
x = sample(1:20, 50, replace=TRUE)

#  fit unweighted
YuleSimon(x)

## Not run: 
# put random weights to see effect of weights
niter = 500
ndata = 200

# generate data and fit unweighted MLE
x    = sample(1:20, ndata, replace=TRUE)
xmle = YuleSimon(x)

# iteration
vec.rho = rep(0,niter)
for (i in 1:niter){
  # random weight
  ww = abs(stats::rnorm(ndata))

  MLE = YuleSimon(x, weight=ww)
  vec.rho[i] = MLE$rho
  if ((i%%10) == 0){
    print(paste0(" iteration ",i,"/",niter," complete.."))
  }
}

# distribution of weighted esti
opar <- par(no.readonly=TRUE)
hist(vec.rho, main="shape 'rho' and MLE")
abline(v=xmle$rho, lwd=3, col="red")
par(opar)

## End(Not run) 

kyoustat/T4mle documentation built on March 26, 2020, 12:09 a.m.