Truncated multivariate normal

  • Joris Menten

    Joris Menten - 2011-09-07

    I would like to use a truncated bivariate normal to model random intercepts
    and slopes, with intercept constrained to be positive and the slope to be

    In OpenBugs I used:

    beta ~ dmnorm(mu.beta, R)I(lim1,lim2)

    with beta the random intercepts, and beta the random slopes. The limits lim 1
    and lim2 are given as data.

    Using the same, but replacing the I by T (as this is an a priori truncated
    distribution), in jags does not seem to work.

    (runtime error "Distribution cannot be bounded in distribution dmnorm").

    Does this mean it is not possible to bound the multivariate normal - or am I
    just doing something evident wrong?


  • Aziz

    Aziz - 2011-09-08

    If you are modelling bivariate data, I think you could by-pass the
    multivariate node and bind two univariate models like this:

    beta ~ dnorm(mu.beta,tau1)T(low1,up1)

    beta ~ dnorm(mu.beta + lam*(beta-mu.beta),tau.iid)T(low2,up2)

    Basically, you use the correlated part of the error in beta inside the mean
    function of beta. Tau.iid is then the precision associated to the independent
    part of the error term in beta. Since you write this as 2 univariate
    distribution, it is straightforward to add truncation constraints.

    You can then use the following "vague" priors/parameter transformation:

    lam ~ dnorm(0,0.0001)

    var1 <- 1/tau1

    var2 <- 1/tau.iid + (lam^2)*var1

    tau1 <- pow(sigma1,-2)

    tau.iid <- pow(sigma.iid,-2)

    sigma1 ~ dunif(0,1000)

    sigma.iid ~ dunif(0,1000)

    And the correlation between beta and beta is given by:

    rho <- lamvar1/sqrt(var1var2)

    Please make some trials first. I think it should work but I'm no expert in
    Bayesian stat. Maybe Martyn can confirm this.

    Hope it helps

  • Joris Menten

    Joris Menten - 2011-09-08

    Thanks - will have a try. I did sort of knew this trick from generating
    bivariate normals - should indeed work. A bit more complicated, but then I can
    also avoid those pesky Wishart distributions as priors. Joris


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks