Dagum: (Weighted) MLE of Dagum Distribution

Description Usage Arguments Value Author(s) Examples

View source: R/Dagum.R

Description

Dagum is characterized by the following probability density function,

f(x;p,a,b) = \frac{ap}{x} ≤ft( \frac{(x/b)^{ap}}{ ≤ft( (x/b)^a + 1 \right)^{p+1} } \right)

where the domain is x \in (0,∞) with two parameters p,a > 0 for shape and one parameter b for scale.

Usage

1
Dagum(x, weight = NULL)

Arguments

x

a length-n vector of values in (0,∞).

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

p

shape parameter p.

a

shape parameter a.

b

scale parameter b.

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
36
37
38
39
40
41
#  generate data from half normal
x = abs(stats::rnorm(100))

#  fit unweighted
Dagum(x)

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

# generate data as above and fit unweighted MLE
x    = abs(stats::rnorm(ndata))
xmle = Dagum(x)

# iterate
vec.p = rep(0,niter)
vec.a = rep(0,niter)
vec.b = rep(0,niter)
for (i in 1:niter){
  # random weight
  ww = abs(stats::rnorm(ndata))

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

# distribution of weighted estimates + standard MLE
opar <- par(no.readonly=TRUE)
par(mfrow=c(1,3))
hist(vec.p, main="shape 'p'"); abline(v=xmle$p,lwd=3,col="red")
hist(vec.a, main="shape 'a'"); abline(v=xmle$a,lwd=3,col="blue")
hist(vec.b, main="shape 'b'"); abline(v=xmle$b,lwd=3,col="green")
par(opar)

## End(Not run) 

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