Search code examples
winbugs

Giving a transformation of a random variable a distribution in WinBUGS


For instance, it is possible to write the following relationship in WinBUGS? If so how?

X/2 ~ dnorm(0,1)

The above code generates an error.

Note that X ~2*dnorm(0,1) doesn't work either.


Solution

  • You can define a node as any function of a distribution (or several distributions), but you must do it via intermediate nodes using deterministic relationships e.g.:

    norm_var ~ dnorm(0,1)
    X <- norm_var * 2
    

    If you set initial values manually, make sure you do this for norm_var and not X.