1
$\begingroup$

Im trying to generate the posterior distribution of $\alpha$ parameter of Pareto Distribution. I did all the job correctly on paper, but when i go to implement in R i have some problems.I have a Pareto sample:

$Pareto$ ($A=20$,$\alpha = 30$ )

a0 <- 10
    alpha0 <- 30
    set.seed(1)
    x <- rpareto(200, alpha0 , a=a0)
pareto.MLE <- function(X)
{
  n <- length(X)
  m <- 10 #min(X)
  a <- n/sum(log(X)-log(m))
  return( c(m,a) ) 
}

pareto.MLE(x)
# 30

I used a Gamma distribution as a prior for $\alpha$ which is a conjugated family for Pareto Distribution:

The Posterior resulted in a $Gamma(\lambda + n ; \beta + \sum(ln(xi/A))$

$N->200$; $A->10$

I choose values for the $\lambda$ and $\beta$ parameters o Gamma Distribution:

lambdaGamma = 2 beta Gamma = 0.5

I have: $\lambda + n = 202 $ and $\beta + \sum(ln(xi/A)= 8.666561$

PosterioriAlpha <- rgamma(200,shape=202,scale=8.666561)
hist(PosterioriAlpha ,prob=T,main='Gamma,scale=8.66')
lines(density(PosterioriAlpha),col='red',lwd=2)

Which gives me this:

enter image description here

Its completely wrong. The MLE Estimation gives me $\alpha$ as 30. What am i doing wrong?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.