[R-sig-Geo] CAR proper
Roger Bivand
Roger.Bivand at nhh.no
Fri Aug 26 08:42:44 CEST 2011
On Thu, 25 Aug 2011, Timothy Mutsvari wrote:
>
> Dear users,
>
> I'm getting the following error when trying to compile my BUGS code:
> "error for node v[1] of type SpatialCARNormal.Node first argument vector
> has wrong length.'
Is this an openBUGS question, an R question, or both? Could you provide
sample R code using R2OpenBUGS if the latter? If you are using R, how did
you calculate the vectors needed? are they the same or different lengths
in R?
Roger
> Here, v is a vector that has the car.normal prior of the form: v[1:N] ~ car.normal(Adj[],weights[],Num[],tau.c)
>
> Also, - Num is vector of length N giving the number of neighbors for each node - Adj is a vector of length = sum of Num[], with each entry being the index of a neighbor - weights is a vector of length = sum of Num[], with each entry being 1. The model is syntactically correct and the data loads as well, but I get the above error when I compile. The data file is too large to attach here though I'd be happy to figure out a way to share it otherwise. I've been stuck on this for over a month now and any help will be greatly appreciated. I'm using OpenBUGS.
>
>
> model{ for (i in 1:N) { Y[i] ~ dbin(p[i], 1)
> logit(p[i]) <- b0 + b1*income[i] + v[i]
> }
> v[1:N] ~ car.normal(Adj[],weights [],Num[],tau.c)
> b0 ~ dflat()
> b1 ~ dflat
> tau.c ~ dgamma(0.001, 0.001)
> }
>
> Regards,
> Timothy
> [L-Biostat]
>
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list