How to estimate the Parameters of "Log Pearson III" distribution and how to generate the random nos. using these estimated parameters in R?

Kindly guide



The Pearson type III distribution is a shifted gamma distribution. A random variable $X$ has log-Pearson III distribution if $\log(X)$ has Pearson III distribution.

Then, the simulation part is simple, simulate from a gamma distribution, shift it (translate it) and then take the exp() of these values.

Now, in order to estimate the parameters, you can either obtain the density of the log-Pearson III distribution or to use its relationship with the shifted-gamma. This is, if you have a sample $(x_1,...,x_n)\sim \mbox{log-Pearson III}$, then $(\log(x_1),...,\log(x_n))\sim \mbox{Pearson III}$ which is also a shifted-gamma and this is easier to estimate.

The following R code implements both, the simulation and the estimation of the parameters of this distribution.

# Simulation from a log-Pearson III
rlogpearson <- function(n,a,b,c) return( exp(rgamma(n,shape=a,rate=b) - c) )

data<- rlogpearson(1000,3,3,5)


# Transformation of the data to obtain a shifted gamma

datat <- log(data)

# - log-likelihoood

ll <- function(par){
if(par[1]>0 &  par[2]>0 & par[3]> -min(datat)) return( -sum(dgamma(datat+par[3],shape=par[1],rate=par[2],log=TRUE))  )
else return(Inf)

# optimisation step




As you can see, the estimators are close to the theoretical values.


The following code shows a function that calculates the quantiles of this distribution. It uses the relationship with the gamma distribution.

qlogpearson <- function(p,a,b,c) return( exp(qgamma(p,shape=a,rate=b) - c) )


If you want to use the estimated parameters, just plug them in this function

param <- optim(c(3,3,5),ll)$par

Another approximation can be obtained by simulating a large sample and calculating the empirical quantiles as follows

samp<- rlogpearson(10000,param[1],param[2],param[3])


Edit II

The CDF can also be easily calculated using that

$$F(x)=P(X<x)= P(\log(X)+c<\log(x)+c),$$

and using that $\log(X)+c$ is a gamma random variable. In R

plogpearson <- function(x,a,b,c) return(pgamma(log(x)+c,shape=a,rate=b))
  • $\begingroup$ Thanks a million for your reply and help. It's working fine. However, I forgot to ask how to use these parameters to find out the quantiles w.r.t given probabilities. I did but not sure. optim(c(3,3,5),ll) # MLE paramaters=optim(c(3,3,5),ll)$par prob_values = runif(10) inverse_pearson_3P = qlgamma3(prob_values, shape=parameters[1], scale=parameters[2], thres=parameters[3], lower.tail=TRUE, log.p=FALSE) $\endgroup$ – Akshata Iyer Apr 9 '13 at 11:08
  • $\begingroup$ I am using this forum for the first time, hence bit struggling with typing etc. Please forgive me. My only requirement is to know how to use estimated parameters (above) to find quantiles or inverse of probabilities? $\endgroup$ – Akshata Iyer Apr 9 '13 at 11:10
  • $\begingroup$ No problem. Please, check the updates. $\endgroup$ – Person Apr 9 '13 at 11:15
  • $\begingroup$ Please, check the edits. The answer already contains the cdf, quantile function and random number generation. $\endgroup$ – Person Apr 9 '13 at 12:39
  • $\begingroup$ Ok.Sorry I missed it as for me there is sort of panicky situation as I have to meet the deadline. So sorry for bothering you. Thanks again. You are really a GENIUS and very considerate "PERSON". :) $\endgroup$ – Akshata Iyer Apr 9 '13 at 12:57

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.