# Get the parameters of a probability distribution

I am trying to generate the parameters of a kumaraswamy distribution

https://en.wikipedia.org/wiki/Kumaraswamy_distribution

I have a mean and CV of a variable x

mean.x <- 3000
cv.x <- 0.1
sd.x <- cv.x * mean.x


I normalise the mean.x and sd.x by a max and min value as follows:

x.max <- 6000
x.min <- 0

norm.mean.x <- (mean.x - x.min)/(x.max - x.min)
norm.sd.x <- (1/(x.max - x.min)) * sd.x


What I want to do is to estimate (via some fitting procedure) the a and b parameters of the kuma distribution? Could anyone explain how this can be done in R? I guess maybe I can start with some default value of a and b, sample n values, find the mean and sd, compared it with the mean and sd I have to derive sum of squared errors and keep changing a and b parameter to arrive at that set that gives the lowest sse. For e.g.

  library(extraDistr)

kuma.n <- rkumar(100, a = 2, b = 1)
mean.kuma <- mean(kuma.n)
sd.kuma <- sd(kuma.n)

ssq <- (norm.mean.x - mean.kuma)^2 + (norm.sd.x - sd.kuma)^2


and keep changing a and b. However, this seems like an endless iteration so was wondering if anyone has a better solution to this.

# EDIT:

the above is a made up data.

• The endless iteration might be a good job for the optim function in stats: see help(optim) or one of the many blogs on that in the net like r-bloggers.com/how-to-use-optim-in-r Oct 24, 2019 at 12:13

This particular distribution has an ugly function describing the mean and variance. So I would propose using maximum likelihood estimation from sampled data. The likelihood function expresses the plausibility of different parameters given a data set. So I would do the following:

1) simulate a lot of data from your mean and cv

2) Fit the data to the Kumaraswamy Distribution using the following R package: https://www.rdocumentation.org/packages/VGAM/versions/1.1-1/topics/kumar the package is described here: https://www.stat.auckland.ac.nz/~yee/VGAM/

• Thank you. The data in my example is just made up data. Oct 24, 2019 at 17:24
• Can you please tell me how do I simulate data for a given mean and CV in your first point? Oct 24, 2019 at 17:25