If you have a random variable $X$ and a function $f$, you can define $y=f(X)$ as a new random variable with a probability density function as follows:
$p(y)=(f^{-1})'(y)p(x)$. For details see here.
Now I have defined a random variable alpha, with an exponential distribution in the following code. I want to add to my model, log(alpha) as a new random variable. How should I implement it in my model?
I already made an effort but it seems that it is wrong, and the reason as been pointed out in answers is the fact that I used stochastic decorator rather than a deterministic one. But because later I want to apply MCMC Metropolis on this variable I need it to be statistic! To clarify it more, I want to apply a Gaussian proposal on the log(alpha). So I need to hand in an stochastic input to Metropolis function.
So this is my model:
import numpy as np
import pymc
lambd=1;
__all__=['alpha']
alpha=pymc.Exponential('alpha', beta=lambd)
@pymc.stochastic(plot=False)
def logalpha(value=0,c=alpha):
return np.log(c)