Generating parameters from lognormal or Gamma likelihood I need to draw the gamma or lognormal parameters only from their likelihood functions. I'm using uniform prior, so  the posterior distribution coincides with the likelihood functions. Is there a direct method to sample the lognormal or gamma parameters only from likelihood function?
 A: Posterior:
$p(\theta|D)\propto p(D|\theta)p(\theta)=p(D|\theta)$ (truncated by unif. prior)
That is,
$p(\theta|D) \propto f(\theta)=\text{(truncated) } p(D|\theta)$
In the lognormal case, $\theta=[\mu,\sigma]$, for instance.
For the Gamma distribution, since you want to sample from a 2D (low-dimensional) distribution, Adaptive rejection sampling should work well if you want uncorrelated samples.
This won't work for the log-normal distribtution as it is not log-concave. The log-concave property is needed for adaptive-rejection sampling to work.
Markov-chain Monte Carlo methods such as Metropolis-Hastings should work in your problem.
A: With the lognormal you can work on the log scale of the data (which is normal); the parameters are the same. The posterior is easy enough to derive; you can integrate out $\mu$ and get that $(\sigma^2|x)$ is inverse-gamma, while $(\mu|\sigma^2,x)$ is then Gaussian, yielding a sample from the joint posterior.
The posterior for the scale parameter of the gamma conditional on the shape is inverse gamma (if you parameterize by the rate, it is gamma).
The marginal posterior for the shape parameter doesn't have a "standard" distribution however, I'd try to look at say an adaptive procedure for that.
[You may find some of the discussion in Daniel Fink's A Compendium of Conjugate Priors (pdf) helpful.]
