I try to implement a second order random walk model for regularly space locations in one dimension (e.g. time) using the car.normal() distribution. However, I get an error when I run the model. Probably I misunderstood the specification of the weights argument? If so, how would the correct specification look like?
I am again grateful for hints...
Here is a minimal example:
For 6 observations Y the corresponding precision matrix is
1 -2 1 0 0 0
-2 5 -4 1 0 0
1 -4 6 -4 1 0
0 1 -4 6 -4 1
0 0 1 -4 5 -2
0 0 0 1 -2 1
It could depend on a multiplicative parameter, which I set to 1.
The corresponding model and data:
model
{
for (i in 1:n) {
Y[i] ~ dnorm(Z[i], 1)
}
Z[1:n] ~ car.normal(adj[], weights[], num[], 1)
}
# Data
list(num=c(2,3,4,4,3,2),
adj = c(
2,3,
1,3,4,
1,2,4,5,
2,3,5,6,
3,4,6,
4,5),
weights=c(-2,1,-2,-4,1,1,-4,-4,1,1,-4,-4,1,1,-4,-2,1,-2),
n=6,
Y=c(-1.28,0.12,0.19,0.17,0.71,-0.85))
If I run the mode, I get the following error:
> out <- BRugsFit("model.txt", "data.txt",
+ inits=function(){list(Z = rep(0,6))},
+ numChains =1)
model is syntactically correct
data loaded
model compiled
[1] "/tmp/RtmpSvInVc/inits1.txt"
Initializing chain 1:
model is initialized
model is already initialized
****** Sorry something went wrong in procedure StdUpdater.Sample in module UpdaterNormal ******
Error in handleRes(res) :
Internal "trap" error in OpenBUGS, or non-existent module or procedure called.
-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list
|