[R-sig-Geo] error message using BRugs package - multivariate distribution must have more than one component

Virgilio Gomez-Rubio v.gomezrubio at imperial.ac.uk
Sat Aug 16 10:47:05 CEST 2008


Philip,

I have checked the code that you have sent and your problem is that you
have not written the car.normal in the right way. You should remove the
line where you specify the car.normal and replace it  (outside the 1:N
loop) by

b[1:N] ~ car.normal(adj[], weights[], num[], taulgacar)

This is the right way of specifying a car normal in WinBUGS and not giving a
distribution to each b[i].

> I am hoping to get a lead when the asdar book comes out next month, 
> but I thought I might be fortunate to get some help from the list as well. 
> I have attached the two models, data files, and R commands to the end of this email. 

In addition, I would remove the term 'mulga' and 'mulgaerror' (perhaps
you mean 'mulgaerr') from  inits because they are not stochastic nodes.
You should also set the initial values for 'sigmalgacar' and not
'taulgacar'.

Given that your problem is not R related, I believe that this other
reference might be more appropriate in your case:

Disease Mapping with WinBUGS and MLwiN 
By Andrew B. Lawson, William J. Browne, Carmen L. Vidal Rodeiro
Published by John Wiley and Sons, 2003 ISBN 0470856041, 9780470856048
292 pages 


They show how to fit many types of spatial model using WinBUGS and
provide lots of examples. They do not show how to use the output to make
maps with R though. Furthermore, if you like hard stuff, you can check
the book by Banerjee et al. which also provides many examples.

Best regards,

Virgilio

P.S: This is the WB code for the new model. I would suggest that you
increase the range of values in the prior for taulga because it seems
too narrow.

model
        {

                for (i in 1 : N) {
                dlga[i] ~ dnorm(mulga[i], taulga)
                mulga[i] <- beta0 + theft[i] + b[i] + drugs[i] +
assault[i] + personalviolence[i] + maliciouspd[i] + mulgaerror[i]
                mulgaerr[i] ~ dunif(0,10)
                mulgaerror[i] <-  pow(mulgaerr[i], -2)
                }

for(k in 1:50)   {
                weights[k] <- 1}

        b[1:N] ~ car.normal(adj[], weights[], num[], taulgacar)

        beta0 ~  dnorm(0, 0.00001)
        taulga ~ dunif(0,10)
        sigma <- sqrt(1 /  taulga)
        sigmalgacar ~ dunif(0,10)
        taulgacar<- 1/(sigmalgacar*sigmalgacar)
}




More information about the R-sig-Geo mailing list