Find distribution of underlying feature

Let's say I have a dataset with values for the variable $W$. The distribution of $W$ doesn't follow any obvious known distribution.

I have a model that gives $W$ as a functions of $E$ and $K, W = f(E, K)$. Function $f$ is not trivial (not just sums and multiplications, and each variable appears more than once).

Know: from another source I derive the distribution of $E$.

So, I know the distribution of $W$ (by having the values) and the distribution of $E$. Can I find the distribution of $K$? And how?

If needed I can give more details.

I had tried the following but I think it's flawed. For each observed value of $W$ I sample 100 values of $E$ and calculate the necessary $K$ to explain that $W$. Then I join all the calculated $K$ and try to fit distributions to this data.

• Is function f known? And do you know the distribution of E as a mathematical expression with a few constants or just as an empirically derived PDF (like E = density(x)? And when you want to infer the distribution of K do you then mean which family (normal OR chi-square OR uniform OR...) or just the posterior distribution over a known distribution family? Dec 20, 2014 at 19:47
• Thanks for your reply. f is known and E is a mixture of two normal distributions, for witch I have the parameters. I do not know the family distribution of K, but I suspect it to be a mixture of a discrete distribution (value 0) with a mixture of normal distributions. However, I might be wrong in this assumption. Dec 21, 2014 at 0:10

I am not an expert on this, but I can give a vague answer with an overall strattegy. I too would take a sampling based approach. However, you are probably right that you actually have the possibility to do better than just isolating K for every observed W.

I would model this in a bayesian framework using Gibbs sampling because (1) bayesian inference is all about computing with distributions and (2) because it is so easy for non-mathematicians like me :-) In your first model, everything but the parameters generating W would be deterministic nodes, including K. So the inference problem should be fairly simple and you will get your K-distribution. And you have data to narrow in the posterior distribution of W.

The next step would then be to add guesses about the distribution of K. If you get any ideas about which parameters/distributions best describe the posterior, you can model that as well and compare the likelihood of these models by having a mixture model with an indicator variable choosing between each one. The relative frequencies that the indices are sampled is the posterior likelihood ratio between these models being true.

Software-wise, many options exist for this but from the BUGS family you can have a look at JAGS, PyMC, OpenBUGS, stan etc. (written in the order of ease of use. JAGS is probably simplest).

If bayesian inference sounds scary and you have a reasonable guess at the distribution-family for K you can compare alternative models using nonlinear frequentist approach. Look at R packages nls and nlm. Or nlmer if you want to do mixed model.

• Thanks for you reply. If can not get a likelihood function for W, I can I soulv ethe problem. PyMC demands some likelihhod function to work with... Dec 23, 2014 at 11:38
• You can create custom priors. This may get you some of the way: stackoverflow.com/questions/23198247/custom-priors-in-pymc Dec 27, 2014 at 10:57