# How to find the Likelihood Function in a Bayesian Model given some Data

How should I find the likelihood function of a Bayesian Model?

For example, if I'm given a coin, I can use the Bernoulli Distribution as the likelihood function (because I know in advance that the outputs are 0 or 1 and it fits that distribution).

What if I'm given some data that I don't know the underlying distribution but it seems to follow a gamma distribution? (gamma is just for the example here, it could be normal, exponential, or some weird distribution).

1. Should I just estimate the parameters of that Gamma (ie fitdist in R) and use these parameters along the likelihood function? (and if that is the case, it wouldn't work with the weird distribution)
2. Use bayesian modeling to estimate the likelihood function. If that is the case, how can I achieve that? (I'm not expecting a printed code here but more like an explanation that puts me in the right direction)

You could indeed then use maximum likelihood to estimate the parameters - that is, find the parameter values that maximize the likelihood function. You can usually do this via some optimization algorithm if your likelihood is reasonably well-behaved. In R you could use for example optim().
If you want to do a Bayesian treatment you'll want to specify a prior (a parameter model) in addition to your likelihood (your data model). In the case of a $\text{gamma}(\alpha, \beta)$ distribution that means you'd want to specify distributions for $\alpha$ and $\beta$ as well. But you don't usually 'estimate the likelihood function' so to speak; you specify it, and then conduct your analysis around that assumption.