# #StackBounty: #pdf #weibull #stan Determining normalizing constant for Weibull distribution

### Bounty: 50

I am fitting a Weibull distribution to some data in Stan. I am trying to reproduce some published values of parameters from a paper. However I am running into problems because I believe the normalizing constant does not match. The paper gives the pdf equation as follows:

\$p(x|mu,nu) = frac{1}{K} (frac{x}{nu})^{mu – 1} exp(-(frac{x}{nu})^{mu})\$

However the Weibull pdf in Stan is:

\$p(x|mu,nu) = frac{mu}{nu} (frac{x}{nu})^{mu – 1} exp(-(frac{x}{nu})^{mu})\$

When I fit the distribution to the same data as the paper, I get different fitted values for the shape and scale parameters (\$mu\$ and \$nu\$) than the ones in the paper, but the paper gives no indication of how to find the normalizing constant K. Is there a way to determine the correct value for the constant so that I can get the correct values of shape and scale parameters?

Here is the (very simple) Stan model I fit:

``````data {
int<lower=0> N;
vector<lower=0>[N] x;
}

parameters {
// Weibull density
real<lower=0> mu;
real<lower=0> nu;
}

model {
// Priors: Weibull density
mu ~ lognormal(1, 1);
nu ~ lognormal(1, 1);

// Likelihood: Weibull density
x ~ weibull(mu, nu);
}
``````

Get this bounty!!!

This site uses Akismet to reduce spam. Learn how your comment data is processed.